struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rob <...@insightoutsight.com.au>
Subject Re: Struts doesn't execute my ActionForm.
Date Sun, 08 Jun 2003 16:34:25 GMT
Thomas Miskiewicz wrote:
> Hi!
> 
> I have a small HTML-Form with 3 textfields. I've implemented the validation
> rules in the validate() method of the ActionForm belonging to the html form.
> Unfortunately Struts isn't using the ActionForm. Why?
> 
> Here my struts-config.xml
> 
> <?xml version="1.0" encoding="ISO-8859-1"?>
> <!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts
> Configuration 1.1//EN"
> 
> "http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd">
> 
> <struts-config>
>    <form-beans>
>      <form-bean name="postTestForm"
>                 type="com.mycompany.PostTestForm"/>
>    </form-beans>

This looks ok.

> 
>    <global-forwards type="org.apache.struts.action.ActionForward">

<global-forwards> <!-- instead -->

>       <forward name="system.error" path="/WEB-INF/jsp/systemError.jsp"/>
>       <forward name="default.action" path="/execute/homePageSetuo"/>
>    </global-forwards>
> 
>    <action-mappings>
> 
>       <action path="/homePageSetup"
>               type="com.mycompany.HomePageSetupAction"
>               unknown="true">
>               <forward name="homepage.success"
> path="/WEB-INF/jsp/homePage.jsp"/>
>       </action>
> 
>       <action path="/postTestSetup"
>              type="com.mycompany.PostTestSetupAction"
>              name="postTestForm"
>              scope="request"
>              validate="false">
>              <forward name="posttest.success"
> path="/WEB-INF/jsp/postTest.jsp" />
> 
>       </action>
> 
>       <action path="/postTest"
>              input="/WEB-INF/jsp/postTest.jsp"

It _is_ ok to have input="/WEB-INF/..."

>             name="postTestForm"
>             scope="request"
>             validate="true"
>             type="com.mycompany.PostTestForm">

You've definately gone wrong with the type here, the
type="..." should specify an Action not a Form.
Perhaps type="com.mycompany.PostTestAction" ?

>             <forward name="posttest.success" path="/execute/homePageSetup"/>
>       </action>
> 
>    </action-mappings>
> </struts-config>
> 
> The validation checks, if the fields are not empty. Even through the fields
> are
> being empty, when I press the Submit button the applications presents me
> the entryform of the whole application. Also the URL looks pretty strange
> http://localhost/myapp/execute/postTest%20name=
> What doesn the %20name= mean? I think this is part of the problem.
> Can someone please tell me what am I doing wrong here?
> 
> Regards
> Tom
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
> 
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Mime
View raw message