Web. XML configuration file, configuration SPRINGMVC:
<servlet>
<servlet-name>springMVC</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<!--set the name and path of the configuration file--
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath*:springmvc-servlet.xml</param-value>
</init-param>
<!--boot order--
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>springMVC</servlet-name>
<url-pattern>/*</url-pattern>//Error
</servlet-mapping>
<!--I thought it was added. * Can be used to indicate all files under the current path, but after the addition of the * number, the Access page resource does not exist, jump page appears 404-->
Controller class Method:......
@RequestMapping ("/checkuser")
Public String checkmemberuser (httpservletrequest req,httpservletresponse Res)
{
System.out.println ("Useraction" +userser.checkuser ()); This will work properly and the console outputs
Return "index";//After adding the * number cannot jump to the index.jsp page
}
The correct one should be:<servlet>
<servlet-name>springMVC</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<!--set the name and path of the configuration file--
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath*:springmvc-servlet.xml</param-value>
</init-param>
<!--boot order--
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>springMVC</servlet-name>
<url-pattern>/</url-pattern>//Correct, access path cannot add * number
</servlet-mapping>
Remove the * number will be normal operation, you can jump to the specified page.
Web. XML configuration Springmvc causes access to the page resource does not exist, jump page appears 404