Ciaran,

When all else fails, cut and paste. :-)

Seriously, I don't know of a way to make the "input" value dynamic. I wish
it could be done like tile definitions with one action mapping extending
another, but, I know that is not supported. So, the simplest solution is to
have two separate action mappings for the one action class that supports
both adds and updates like so:

 <action path="/clientaction/add"
         type="ie.sentenial.application.actions.ClientAction"
         name="clientForm"
         scope="request"
         input="/pages/addClient.jsp" 
         attribute="clientForm" >
 </action>

 <action path="/clientaction/update"
         type="ie.sentenial.application.actions.ClientAction"
         name="clientForm"
         scope="request"
         input="/pages/updateClient.jsp" 
         attribute="clientForm" >
 </action>

You still get code reuse of your action class, but, you have to duplicate
the action mapping specification.

If you want to avoid duplicating the action mapping, the other way to go is
to have a single JSP that supports both adds and updates with conditional
logic in the JSP based on a "mode" parameter which indicates whether it is
being used for an add or an update.

- Van

Mike Van Riper
mailto:[EMAIL PROTECTED]
http://www.baychi.org/bof/struts/

P.S. You don't need to specify both "name" and "attribute" values in your
action mappings unless you want to store the form under a different name at
request/session scope than the form configuration name. What you have done
doesn't hurt anything, it is just not necessary to specify an "attribute"
value unless the value specified for it is different than the "name" value.

> -----Original Message-----
> From: Ciaran Hanley [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, January 27, 2004 10:57 AM
> To: Struts User Mailing List
> Subject: Problems Redirecting To Input Page After Vaildation Fails
> 
> 
> Hello can anybody help me with this problem I'm having please?
>  
> I am using the same action to perform two functions
>  
> <action path="/clientaction"
>         type="ie.sentenial.application.actions.ClientAction"
>         name="clientForm"
>         scope="request"
>         input="/pages/addClient.jsp" 
>         attribute="clientForm" >
> </action>
>  
> This is called as follows from 2 different forms:
>  
> <html:form action="/clientaction?action=update" focus="clientName"
> onsubmit="return validateClientForm(this)">
>  
> and 
>  
> <html:form action="/clientaction?action=add" focus="clientName"
> onsubmit="return validateClientForm(this)">
>  
> The problem is that because I have
>  
>         input="/pages/addClient.jsp"          
>  
> ...that when a validation fails while doing an update it is directed
> back to the addClient.jsp rather than the updateClient.jsp
> As far as I know the input field will not take dynamic 
> values. I am not
> sure how to resolve this problem. I need to be directed back to the
> correct page when validations fail
>  
> Thanks
> Ciaran
> 

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

Reply via email to