> -----Original Message-----
> From: Sebastian Ho [mailto:[EMAIL PROTECTED]
> Sent: Thursday, August 19, 2004 6:26 PM
> To: Struts Users Mailing List
> Subject: Re: different inputs in struts-config
> 
> 
> Thanks Susan.
> 
> Refer to my comments below
> 
> Sebastian Ho
> 
> 
> On Thu, 2004-08-19 at 21:23, Susan Bradeen wrote:
> > Sebastian Ho <[EMAIL PROTECTED]> wrote on 
> 08/19/2004 05:19:35 
> > AM:
> > 
> > > hi
> > > 
> > > I used the same actionform for a few JSP pages, which I 
> guess is good
> > > practice. The problem occurs when I add in validation in 
> my ActionForm. 
> > > 
> > > Because in the struts-config, only one <input> is 
> specified for every
> > > Action. Therefore, whenever validation fails and struts 
> display the
> > > error messages, struts prints it in the JSP given in <input>.
> > > 
> > > Ideally, struts should forward and prints out the error 
> messages in the
> > > JSP that calls the ActionForm.
> > > 
> > > I tried adding in multiple action mapping in my struts-config with
> > > identical settings except <input>, which I hope struts 
> will be smart
> > > enough to decide which mapping to use. Unfortuntely, it doesn't.
> > >
> > 
> > Yes, you can reuse your actionform for multiple action 
> mappings, but are 
> > your action mappings really identical except for the input? If I 
> > understand what you are trying to do, it sounds like you 
> should have:
> > 
> > Action1 specifies ActionForm1 and input JSP1 and forwards to JSP1.
> > JSP1 probably then submits to Action2.
> > Action2 specifies ActionForm1 and input JSP2 and forwards to JSP2.
> > JSP2 probably then submits to Action3.
> > Action3 specifies ActionForm1 and input JSP3 and forwards to JSP3.
> > 
> 
> All of them ues the same action Action because I am using
> LookupDispatchAction.
> 
> So the struts-config ideally should be (which doesn't work) :
> Action1 specifies ActionFrom1 and input JSP1.
> Action1 specifies ActionForm1 and input JSP2.
> Action1 specifies ActionForm1 and input JSP3.
> 
> How do I achieve this effect?

Way 1:
Struts config:
<action path="/action1" type="com.blah.MyAction" input="jsp1.jsp" blah>
        <forward blah
        <forward blah
</action>
<action path="/action2" type="com.blah.MyAction" input="jsp2.jsp" blah>
        <forward blah
        <forward blah
</action>
<action path="/action3" type="com.blah.MyAction" input="jsp3.jsp" blah>
        <forward blah
        <forward blah
</action>

Action form:
class MyForm extends ValidatorActionForm{
blah
}

validation.xml:
<form name="/action1">
blah
</form>
<form name="/action2">
blah
</form>
<form name="/action3">
blah
</form>



> 
> > Is that about right? In this case, Validator should work fine.
> > 
> > Hth,
> > Susan Bradeen
> >  
> > > I have read online that this strategy is quite popular. 
> Therefore I am
> > > sure there is a solution to this problem.
> > > 
> > > How do I forward the ActionError to the correct JSP 
> instead of the one
> > > in <input>?
> > > 
> > > Thanks
> > > 
> > > Sebastian Ho
> > > 
> > > 
> > > 
> ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > For additional commands, e-mail: [EMAIL PROTECTED]
> > > 
> > > 
> > > 
> > 
> ______________________________________________________________
> _______________
> > > Scanned for SoftLanding Systems, Inc. by IBM Email Security 
> > > Management Services powered by MessageLabs. 
> > > 
> > 
> ______________________________________________________________
> _______________
> > 
> > 
> > 
> ______________________________________________________________
> _______________
> > Scanned for SoftLanding Systems, Inc. by IBM Email Security 
> Management Services powered by MessageLabs. 
> > 
> ______________________________________________________________
> _______________
> > 
> > 
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > 
> > 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to