这是struts的小例子,不过在点了提交按钮只后,出现如题的错误,望高人解答!!谢谢!!!
这是web.xml:
<servlet>
<servlet-name>action</servlet-name>
<servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
<init-param>
<param-name>config</param-name>
<param-value>/WEB-INF/struts-config.xml</param-value>
</init-param>
<load-on-startup>0</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>action</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>
</web-app>
<struts-config>
<form-beans>
<form-bean name="loginForm" type="struts.LoginForm"></form-bean>
</form-beans>
<action-mappings>
<action path="/login" type="struts.LoginAction" name="loginForm">
<forward name="loginSuccess" path="/LoginSuccess.jsp"></forward>
<forward name="loginFailure" path="/LoginFailure.jsp"></forward>
</action>
</action-mappings>
</struts-config>
Code
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
<form action="<%=request.getContextPath() %>/login.do" method="post">
username:<input type="text" name="username"><br>
password:<input type="password" name="password"><br>
<input type="submit" value="login">
</form>
</body>
</html>
把 <form action="<%=request.getContextPath() %>/login.do" method="post">改成<form action="<%=request.getContextPath() %>/login" method="post">试试