我搜索了关于Spring MVC调度程序的404错误页面的所有答案,我找不到问题的答案。
我也遇到了Spring框架4.1.6的问题,因为它不再具有用于登录表单的SimpleForm。
我知道我需要Maven使用最新的Spring Security登录,我计划创建一个新的Spring / Maven项目并导入该应用程序。
我真的想知道在将其导出到Spring / Maven项目之前我正在进行流量控制。所以任何有关为什么我的欢迎屏幕没有找到的帮助...非常感谢。
继承我的web.xml
enter code here<servlet>
<servlet-name>springMVCpizza</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/config/springMVCpizza-servletConfig.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>springMVCpizza</servlet-name>
<url-pattern>*.jsp</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>Welcome.jsp</welcome-file>
</welcome-file-list>
这是我的调度程序 - servlet:
<mvc:annotation-driven />
<context:component-scan base-package="com.pizza.controllers" />
<bean id="urlMapping" class="org.springframework.web.servlet.SimpleUrlHandlerMapping">
<property name="mappings">
<props>
<prop key="Welcome.jsp">welcomePageController</prop>
</props>
</property>
</bean>
<bean id= "welcomePageController" class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="LogIn" ref="LoginFormController">
</property>
</bean>
<bean id="loginFormController" class="com.pizza.controllers.loginFormController"></bean>
<bean id="localeChangeInterceptor" class="org.springframework.web.servlet.i18n.LocaleChangeInterceptor">
<property name="paramName" value="lang"/></bean>
<bean id="urlMapping" class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
<property name="interceptors">
<list>
<ref bean="localeChangeInterceptor"/>
</list>
</property>
<property name="urlMap">
<map>
<entry key="/LogIn.jsp">
<ref bean="loginFormController"/>
</entry>
</map>
</property>
</bean>
<bean id="loginFormController" class="com.pizza.web.LoginFormController">
`enter code here`<property name="commandName"><value>login</value></property>
`enter code here` <property name="commandClass"><value>com.pizza.web.LogIn</value></property>
</bean>
<bean id="loginValidator" class="com.pizza.web.LoginValidator"/>
<bean id="loginFormController" class="com.pizza.controllers.LoginFormController">
<property name="sessionForm"><value>false</value></property>
<property name="commandName"><value>login</value></property>
<property name="commandClass"><value>com.pizza.web.LogIn</value> </property>
<property name="validator"><ref bean="loginValidator"/></property>
<property name="formView"><value>LogIn.jsp</value></property>
<property name="successView"><value>success</value></property>
<property name="urlMap">
<map>
<entry key="/LogIn.jsp">
<ref bean="loginFormController"/>
</entry>
</map>
</property>
</bean>
<bean id="LocaleChangeInterceptor"
class="org.springframework.web.servlet.i18n.LocaleChangeInterceptor">
<property name="paramName" value="hl"/>
</bean>
<bean id="localeResolver" class="org.springframework.web.servlet.i18n.SessionLocaleResolver"/>
<bean id="ViewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix" value="/WEB-INF/jsp/" />
<property name="suffix" value=".jsp" />
</bean>
<bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver" >
<!-- maximum file size in bytes -->
<property name ="maxUploadSize" value="100000"/>
</bean>
继承人欢迎jsp:
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Welcome to the Pizza Store</title>
</head>
<body bgcolor="#EEEEEE">
<center>
<h1>Welcome to the Pizza Store!</h1>
<a href="LogIn.jsp">Sign In</a>
<p>Or </p> <a href="createAccount.jsp">Create Account</a>
</center>
</body>
</html>