关于springMVC配置出错
刚刚接触springmvc在配置的时候出错了,麻烦懂得朋友教教我,谢谢你们!web.xml配置
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.
xmlns="http://java.
xsi:schemaLocation="http://java. http://java.
id="WebApp_ID" version="3.0">
<servlet>
<servlet-name>springmvc</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/springmvc-config.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>springmvc</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
</web-app>
springmvc-config.xml配置
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.
xmlns:xsi="http://www. xmlns:mvc="http://www.
xmlns:p="http://www. xmlns:context="http://www.
xmlns:aop="http://www. xmlns:tx="http://www.
xsi:schemaLocation="http://www.
http://www.
http://www.
http://www.
http://www.
http://www.
http://www.
http://www.
http://www.
http://www.
http://www.
http://www.
<bean name="/hello" class="org.fkit.controller.HelloController" />
<bean
class="org.springframework.web.servlet.handler.BeanNameUrlHandlerMapping" />
<bean
class="org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter" />
<bean
class="org.springframework.web.servlet.view.InternalResourceViewResolver" />
</beans>
HelloController.ava配置
package org.fkit.controller;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.
import org.
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.Controller;
public class HelloController implements Controller {
private static final Log logger = LogFactory.getLog(HelloController.class);
@Override
public ModelAndView handleRequest(HttpServletRequest arg0,
HttpServletResponse arg1) throws Exception {
logger.info("handleRequest被调用");
ModelAndView mv = new ModelAndView();
mv.addObject("message","Helloworld!");
mv.setViewName("/WEB-INF/content/welcome.jsp");
return mv;
}
}
welcome.jsp配置
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>welcome</title>
</head>
<body>
${requestScope.message }
</body>
</html>
运行后eclipse自动跳转到http://localhost:8080/SpringMVCTest/WEB-INF/content/welcome.jsp
报404错误