Personally, I would try to use the same page for add, update and delete,
which would solve this problem. If this is not an option for you, you may
have to deal with it in ClientAction.

Remove the input attribute from your action mapping, add validate="false",
and add a couple of forward elements.

<action path="/clientaction"
  type="ie.sentenial.application.actions.ClientAction"
  name="clientForm"
  scope="request"
  validate="false"      
  attribute="clientForm" >
  <forward name="AddValidationError" path="/pages/addClient.jsp"/>
  <forward name="UpdateValidationError" path="/pages/updateClient.jsp"/>
</action>

Then inside ClientAction, programmatically call the validate() method, since
the framework won't be calling it for us (validate="false"). If validation
fails, return the appropriate ActionForward, based on whether you are adding
or updating.

Brian Barnett

-----Original Message-----
From: Ciaran Hanley [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, January 27, 2004 11: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