struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Daniel Watrous" <dwatr...@hotmail.com>
Subject Re: Trouble with DispatchAction and ValidatorActionForm
Date Mon, 07 Feb 2005 20:33:16 GMT
by adding 'validate="false"' to my action mapping the page now loads.  Is 
there some undocumented incompatibility when using DispatchAction and 
ValidatorActionForm together?

DW

----- Original Message ----- 
From: "Daniel Watrous" <dwatrous@hotmail.com>
To: "Struts Users Mailing List" <user@struts.apache.org>
Sent: Monday, February 07, 2005 1:10 PM
Subject: Trouble with DispatchAction and ValidatorActionForm


> Hello All,
>
> I keep getting a BLANK PAGE, with NO ERRORS.  Any recommendations are 
> appreciated...
>
> I am interested in building an Action that allows me to add a database 
> record and edit existing records.  Since both actions deal with the same 
> table I want to use the DispatchAction and keep the add/edit code in one 
> class file.  Accordingly I made:
>
> public class StakeAction extends DispatchAction {
>
>    /** Add a Party */
>    public ActionForward add (ActionMapping mapping,
>            ActionForm form,
>            HttpServletRequest request,
>            HttpServletResponse response) throws Exception {
>        PartyForm stakeForm = (PartyForm) form;
>        return mapping.findForward("success");
>    }
>
>    /** Edit a Party */
>    public ActionForward edit (ActionMapping mapping,
>            ActionForm form,
>            HttpServletRequest request,
>            HttpServletResponse response) throws Exception {
>        PartyForm stakeForm = (PartyForm) form;
>        return mapping.findForward("success");
>    }
> }
>
> I do want to perform validation on each action and so I wrote my 
> PartyForm:
>
> public class PartyForm extends ValidatorActionForm {
>
>    private String name;
>    private String phone;
>    private String streetLine1;
>    ...
>
>    //gettters/setters
> }
>
> Now I should be ready to setup the configuration files:
> first struts-config.xml
>
>        <!-- Add a Stake -->
>        <action path="/app/ManageStake"
> 
> type="org.onugjournal.wardlistapp.webapp.actions.StakeAction"
>                name="partyForm"
>                parameter="function"
>                input="manage_stake.jsp">
>            <forward name="failure" path="error"/>
>            <forward name="success" path="/manage_stake.jsp"/>
>        </action>
>
> and in validations.xml
>
>        <form name="/app/ManageStake">
>            <field property="name" depends="required">
>                <arg key="prompt.stakeName"/>
>            </field>
>            <field property="phone" depends="required">
>                <arg key="prompt.phoneNumber"/>
>            </field>
>            <field property="streetLine1" depends="required">
>                <arg key="prompt.street1"/>
>            </field>
>            ...
>        </form>
>
> to call the pages I use
>
> <html:link action="/app/ManageStake?function=add"><bean:message 
> key="navLink.addStake"/></html:link>
> which ends up looking like 
> http://localhost:8080/MyApp/app/ManageStake.do?function=add
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
> 

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


Mime
View raw message