? ? ? ?
Http://localhost/SSM The default entry is the landing page, if after landing, then enter Http://localhost/SSM , you should let it go to the homepage.
We can configure user/main.do directly on the Web. xml
<?xml version= "1.0" encoding= "UTF-8"? ><web-app xmlns:xsi= "Http://www.w3.org/2001/XMLSchema-instance" xmlns= "Http://java.sun.com/xml/ns/javaee" xsi:schemalocation= "Http://java.sun.com/xml/ns/javaee/http Java.sun.com/xml/ns/javaee/web-app_2_5.xsd "id=" webapp_id "version=" 2.5 "> <display-name>ssm</ display-name> <welcome-file-list> <welcome-file>user/main.do</welcome-file> </ Welcome-file-list></web-app>
The following is the interceptor configuration
package com.gj.filter;import javax.servlet.http.httpservletrequest;import Javax.servlet.http.httpservletresponse;import org.springframework.web.servlet.handlerinterceptor;import org.springframework.web.servlet.ModelAndView;import com.gj.model.User;public class logininterceptor implements handlerinterceptor{//private logger logger = Logger.getlogger (logininterceptor.class); private static final string[] ignore_ uri = {"/login", "WeChat", "register", "Checkusernamerepeat", "Save"}; @Overridepublic void Aftercompletion (httpservletrequest arg0,httpservletresponse arg1, object arg2, EXCEPTION&NBSP;ARG3) throws exception {// todo auto-generated method stub}@ Overridepublic void posthandle (HTTPSERVLETREQUEST&NBSP;ARG0,&NBSP;HTTPSERVLETRESPONSE&NBSP;ARG1, OBJECT&NBSP;ARG2,&NBSP;MODELANDVIEW&NBSP;ARG3) throws  exception {} @Overridepublic boolean prehandle (httpservletrequest request, Httpservletresponse response,object obj) throws exception {boolean flag = false; string url = request.getrequesturl ( ). toString (); system.out.println (">>>: " + url); for (String s : ignore_uri) { if (Url.contains (s)) { flag = true; break; } } if (!flag) { User user = (User) request.getsession () getattribute ("CurrentUser" ); if (User != null) { if (Null==user.getwechat_num_type () && url.indexof ( "Presave.do") >-1 && url.indexof ("user") < 0) { flag = false; request.getsession (). SetAttribute ("Info", "true"); response.sendredireCT (Request.getcontextpath () + "/user/presave.do"); } else { flag = true; } } else { Response.sendredirect (Request.getcontextpath () + "/login.jsp"); } &nbSp; } return flag;}}
If Http://localhost/SSM is found to be a 404 error, verify that it is TOMCAT7 or above if the code does not have a problem.
Summary sentence: If your environment is SPRINGMVC, you want to configure the Web. XML Direct jump SPRINGMVC link, tomcat must be more than 7
Web. XML Direct Jump SPRINGMVC link problem