Home > Back-end >  When you use the Eclipse make SSM framework why always 404
When you use the Eclipse make SSM framework why always 404

Time:09-17

Package sunyangovo;
The import org. Springframework. Stereotype. The Controller;
import org.springframework.web.bind.annotation.RequestMapping;
The import org. Springframework. Web. Bind. The annotation. RequestMethod;
The import org. Springframework. Web. Servlet. ModelAndView;

@ Controller
@ RequestMapping ("/system ")
Public class Conn {
@ RequestMapping (value="https://bbs.csdn.net/index", method=RequestMethod. GET)
Public ModelAndView index (ModelAndView model) {
//TODO Auto - generated constructor stub
Model. SetViewName (system/" index ");
Model. The addObject (" name ", "sadwad");
Return the model;
}

}
web. XML:
<? The XML version="1.0" encoding="utf-8"?>


CharacterEncodingFilter

Org. Springframework. Web. Filter. CharacterEncodingFilter


Encoding
Utf-8 & lt;/param - value>


ForceEncoding
True




CharacterEncodingFilter
/* & lt;/url - pattern>



HiddenHttpMethodFilter

Org. Springframework. Web. Filter. HiddenHttpMethodFilter



HiddenHttpMethodFilter
/* & lt;/url - pattern>



ContextConfigLocation
The classpath: config/spring/applicationContext. Xml


Org. Springframework. Web. Context. ContextLoaderListener



Log4jConfigLocation & lt;/param - name>
The classpath: config/log4j. Properties


Org. Springframework. Web. Util. Log4jConfigListener & lt;/listener - class>



DispatcherServlet

Org. Springframework. Web. Servlet. DispatcherServlet


ContextConfigLocation
The classpath: config/for springmvc/for springmvc. Xml


1



DispatcherServlet
/



404 & lt;/error - code>
/WEB - INF/errors/404. Jsp






For springmvc. XML:
<? The XML version="1.0" encoding="utf-8"?>
XMLNS: xsi="http://www.w3.org/2001/XMLSchema-instance" XMLNS: context="http://www.springframework.org/schema/context"
XMLNS: MVC="http://www.springframework.org/schema/mvc" XMLNS: aop="http://www.springframework.org/schema/aop"
XMLNS: task="http://www.springframework.org/schema/task"
Xsi: schemaLocation="HTTP://http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-4.3.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.3.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.3.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-4.3.xsd
http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task-3.2.xsd "& gt;

  • Related