我正在尝试实现这个系统:http ://en.pudn.com/downloads108/sourcecode/java/jsp/detail446536_en.html
但我在登录时收到 404 错误。我输入网址:localhost:8080/voting/。正确输入用户名和密码后,我提交表单并收到 404 错误:
http://localhost:8080/voting/login.html?method=login
HTTP Status 404 -
type Status report
message
description The requested resource () is not available.
Apache Tomcat/7.0.29
我正确配置了数据库。我不明白有什么问题?请问,有人可以帮忙吗?
有 struts-config.xml 代码:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.2//EN" "http://struts.apache.org/dtds/struts-config_1_2.dtd">
<struts-config>
<data-sources>
<data-source type="org.apache.commons.dbcp.BasicDataSource">
<set-property property="url" value="jdbc:mysql://localhost:3306/vote"/>
<set-property property="driverClassName" value="com.mysql.jdbc.Driver"/>
<set-property property="username" value="root"/>
<set-property property="password" value="123"/>
<set-property property="maxCount" value="50" />
<set-property property="minCount" value="30" />
<set-property property="maxActive" value="10" />
<set-property property="maxWait" value="5000" />
<set-property property="defaultAutoCommit" value="false" />
</data-source>
</data-sources>
<form-beans >
<form-bean name="loginForm" type="edu.school.voting.control.LoginForm" />
<form-bean name="votesForm" type="edu.school.voting.control.VotesForm" />
<form-bean name="optionsForm" type="edu.school.voting.control.OptionsForm" />
</form-beans>
<global-exceptions />
<global-forwards />
<action-mappings >
<action
attribute="loginForm"
input="/login.jsp"
name="loginForm"
parameter="method"
path="/login"
scope="request"
type="edu.school.voting.control.LoginAction">
<forward name="success" path="/votes.jsp" contextRelative="true" />
<forward name="admin" path="/admin/admin.jsp" />
<forward name="error" path="/error.jsp" />
<forward name="input" path="/login.jsp" />
<forward name="showuser" path="/admin/user/showuser.jsp" />
<forward name="amenduser" path="/admin/user/edituser.jsp" />
<forward name="findusers" path="/login.html?method=list" />
<forward name="createuser" path="/admin/user/adduser.jsp" />
</action>
......................................
login.jsp 中的代码:
<form id="loginForm" name="loginForm" method="post" action="<%=request.getContextPath()%>/login.html?method=login">
<table width="240" height="165" border="0" cellpadding="0" cellspacing="0">
<tr>
<td align="center" valign="middle"><table width="230" border="0" align="center" cellpadding="5" cellspacing="0" class="p1">
<tr>
<td align="right"> </td>
<td> </td>
</tr>
<tr>
<td width="45" align="right">ID:</td>
<td width="165"><input class="inputPSW" name="account" id="account" type="text" maxlength="16"></td>
</tr>
<tr>
<td align="right">Password:</td>
<td><input class="inputPSW" id="pwd" name="pwd" type="password" maxlength="16"></td>
</tr>
<tr>
<td colspan="2" align="center">
<img onClick="return CheckForm();" src="<%=request.getContextPath()%>/images/login/bn_login1.gif" id="Image1" onMouseOver="MM_swapImage('Image1','','<%=request.getContextPath()%>/images/login/bn_login2.gif',1)" onMouseOut="MM_swapImgRestore()">
<img onClick="return resetBt();" src="<%=request.getContextPath()%>/images/login/bn_reset1.gif" id="Image2" onMouseOver="MM_swapImage('Image2','','<%=request.getContextPath()%>/images/login/bn_reset2.gif',1)" onMouseOut="MM_swapImgRestore()">
<input name="CheckLogin" type="hidden" id="CheckLogin" value="True"> </td>
</tr>
</table></td>
</tr>
</table>
</form>
这是我的 web.xml 文件:
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.4" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
<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>
<init-param>
<param-name>debug</param-name>
<param-value>3</param-value>
</init-param>
<init-param>
<param-name>detail</param-name>
<param-value>3</param-value>
</init-param>
<load-on-startup>0</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>action</servlet-name>
<url-pattern>*.html</url-pattern>
</servlet-mapping>
<filter>
<filter-name>encoding</filter-name>
<filter-class>edu.school.voting.common.EncodingFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>encoding</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<filter>
<filter-name>safty</filter-name>
<filter-class>edu.school.voting.common.SaftyFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>safty</filter-name>
<url-pattern>/admins/*</url-pattern>
</filter-mapping>
<welcome-file-list>
<welcome-file>login.jsp</welcome-file>
</welcome-file-list>
</web-app>
我在哪里做错了?