日期:2014-05-18  浏览次数:20717 次

【求助】struts例子 找了好几天就是找不到错误
login.jsp

<%@   page   contentType= "text/html;charset=GBK "%>

<%@   taglib   uri= "/WEB-INF/tlds/struts-html.tld "   prefix= "html "%>
<html:html>
<head> <title> login </title> </head>
<body>
<html:form   action= "/login.do "   method= "post ">
<table>
<tr>
<td> 用户名: </td> <td> <html:text   property= "userName "/> </td>
</tr>
<tr>
<td> 密     码: </td> <td> <html:password   property= "userPwd "/> </td>
</tr>
<tr>
<td> <html:submit   value= "登   录 "/> </td> <td> <html:reset   value= "重   置 "/> </td>
</tr>
</table>
</html:form>
  </body>
</html:html>


web.xml
<?xml   version= "1.0 "   ?>
<web-app   xmlns= "http://java.sun.com/xml/ns/j2ee "   xmlns:xsi= "http://www.w3.org/2001/XMLSchema-instance "   xsi:schemaLocation= "http://java.sun.com/xml/ns/j2ee   http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd "   version= "2.4 ">
       
        <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> 1 </load-on-startup>
        </servlet>
        <servlet-mapping>
                <servlet-name> action </servlet-name>
                <url-pattern> *.do </url-pattern>
        </servlet-mapping>
</web-app>

struts-config.xml
<?xml   version= "1.0 "   ?>
<!DOCTYPE   struts-config   PUBLIC   "-//Apache   Software   Foundation//DTD   Struts   Configuration   1.2//EN "   "http://jakarta.apache.org/struts/dtds/struts-config_1_2.dtd ">
<struts-config>
        <form-beans>
                <form-bean   name= "loginForm "   type= "org.huoshan.struts.test1.form.LoginForm "   />
        </form-beans>
        <action-mappings>
                <action   name= "loginForm "   path= "/login.do "