- resending: hope this doesn't end up as a duplicate - Another option would be to call the validate() method yourself and return the appropriate <forward>.
add "validate=false" to your mapping, plus your forms as forwards so you can still configure them in your struts-config: <action path="/clientaction" type="ie.sentenial.application.actions.ClientAction" name="clientForm" scope="request" validate="false" attribute="clientForm" > <forward name="addForm" path="/pages/addClient.jsp"/> <forward name="updateForm" path="/pages/updateClient.jsp"/> </action> - this way, the RequestProcessor won't call validate(). in your action, before you proceed, you can do something similar to: public ActionForward execute( ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { ActionErrors errors = form.validate(mapping, request); if ((errors != null) && (!errors.isEmpty())) { request.setAttribute(Globals.ERROR_KEY, errors); if ("update".equals(request.getParameter("action"))) { return mapping.findForward("updateForm"); } else { return mapping.findForward("addForm"); } } // ... } - Hubert --- "Van Riper, Mike" <[EMAIL PROTECTED]> wrote: > 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 > > > __________________________________ Do you Yahoo!? Yahoo! SiteBuilder - Free web site building tool. Try it! http://webhosting.yahoo.com/ps/sb/ --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]