2012-09-10 2 views
-2

나는이 시스템을 구현하기 위해 노력하고있어 : http://en.pudn.com/downloads108/sourcecode/java/jsp/detail446536_en.html구현 투표 시스템 스트럿, MySQL은

을하지만 난 로그인시 404 오류가 발생합니다. url : localhost : 8080/voting /을 입력합니다. 가 입력하는 사용자 및 암호 후, 올바르게, 나는 양식을 제출하고 404 오류 가지고 : 나는 DB 올바르게 구성

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 

합니다. 무슨 문제인지 이해가 안 되니? 누구든지 도와 드릴 수 있습니까?

<?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> 

:

<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">&nbsp;</td> 
        <td>&nbsp;</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()">&nbsp; 
        <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 파일입니다 :의 login.jsp에서

<?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> 
    ...................................... 

코드 :

은 스트럿 - config.xml의 코드 내가 잘못하고있는거야?

+1

하는 방법에 확실하지; 로그에 뭐가 들었 니? 코드가 뭐니? 구성? 등 –

+0

나는이 문제를 이해하기 위해 스스로 시도하는 것이 중요하기 때문에이 응용 프로그램을 처음 시도한 사람을 찾고 싶습니다. – rakela

+0

이것은 잘못된 구성으로 인한 것일 수 있습니다. 오류 http 404는 리소스 또는 메소드를 사용할 수 없음을 의미합니다. 구성에 대한 일부 발췌 문장을 보여 주면 문제를 이해하는 데 도움이됩니다. –

답변

0

실제로 액션 서블릿을 *.html으로 매핑하지 않으면 양식 태그의 "action" 속성이 거의 틀린 것입니다. 디스패치 작업을 사용하는 경우 작업은 struts-config 파일에 구성된 작업을 가리켜 야합니다.

그렇다면 왜 Struts 1 양식 태그를 사용하지 않는 것입니까? 그들은 물건을 훨씬 쉽게 만듭니다. 또한 JSP 파일을 WEB-INF 아래에 두어 클라이언트에서 직접 액세스 할 수 없도록하는 것이 좋습니다.

또한,이 스프링 MVC, 최대 절전 모드, 또는 스트럿츠 2와 아무 상관이있다

+0

이 응용 프로그램을 작동시켜야합니다. 그것이 어떤 프레임 워크를 사용하든간에. 그것을 고치려면 어떻게해야한다고 생각하니? – rakela

+0

@rakela 문제를 진단하는 데 필요한 정보를 제공하지 않습니다. 404? 존재하지 않는 리소스에 액세스하려고합니다. 나는 당신의 행동 매핑이 무엇인지 모른다. 태그는 어떤 기술이 사용되는지에 관한 게시물에 메타 데이터를 추가하기위한 것입니다. Struts 1을 사용하고 있다면, Struts 1이 아닌 다른 것으로 태그를 지정하는 것이 이상합니다. –