RE: ActionForm validate and redirect
> -Original Message- > From: news [mailto:[EMAIL PROTECTED] Behalf Of Ilja Smoli > Sent: Friday, December 03, 2004 7:33 AM > To: [EMAIL PROTECTED] > Subject: ActionForm validate and redirect > > > Hi > I use validate method in one of my ActionForms, after > validation is fail, > method redirects browser to wahatever is set in > struts-config.xml under > input attribut... I faced problem that i need this value to > be dynamic. (I > want to redirect a user to same page from where form has been > submitted but > with error messages. And this page has query paramters :( ) > Trying to call actionMapping.setInput("") gives > exception...(Frozen config) > So seems to be ActionForm validating is not so flexible and > cool :-)? Or > maybe application must use static pages where forms are located? > Of course I can do validation in action and achieve needed result > Opinion of experts? This has been discussed on the list quite a bit. Check the archives. > Ilja. > > > > > > - > 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]
RE: ActionForm validate and redirect
I did this by subclassing the RequestProcessor and modifying processValidate(). I place a value in the request which indicates the current url and don't define an input attribute for the action mappings that need this dynamic input functionality. In processValidate() if mapping.getInput() == null, then I look for my current url parameter and use that if it exists. robert > -Original Message- > From: news [mailto:[EMAIL PROTECTED] Behalf Of Ilja Smoli > Sent: Friday, December 03, 2004 9:33 AM > To: [EMAIL PROTECTED] > Subject: ActionForm validate and redirect > > > Hi > I use validate method in one of my ActionForms, after validation is fail, > method redirects browser to wahatever is set in struts-config.xml under > input attribut... I faced problem that i need this value to be dynamic. (I > want to redirect a user to same page from where form has been submitted but > with error messages. And this page has query paramters :( ) > Trying to call actionMapping.setInput("") gives exception...(Frozen config) > So seems to be ActionForm validating is not so flexible and cool :-)? Or > maybe application must use static pages where forms are located? > Of course I can do validation in action and achieve needed result > Opinion of experts? > Ilja. > > > > > > - > 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]
Re: ActionForm validate and redirect
You can't modify the actual struts instances that were configured in struts-config. However, you can handle the validation in your Action object (see http://marc.theaimsgroup.com/?l=struts-user&m=109302108205069&w=2) and redirect with parameters by constructing your own ActionForward instance. There's a patch to an open enhancement request that you can use: http://issues.apache.org/bugzilla/attachment.cgi?id=9369 The enhancement request is http://issues.apache.org/bugzilla/show_bug.cgi?id=866. If you want to pass the ActionMessage objects as part of the url, you can use a set of classes I've been using: http://www.rabago.net/struts/redirect/ Hubert On Fri, 3 Dec 2004 16:33:15 +0200, Ilja Smoli <[EMAIL PROTECTED]> wrote: > Hi > I use validate method in one of my ActionForms, after validation is fail, > method redirects browser to wahatever is set in struts-config.xml under > input attribut... I faced problem that i need this value to be dynamic. (I > want to redirect a user to same page from where form has been submitted but > with error messages. And this page has query paramters :( ) > Trying to call actionMapping.setInput("") gives exception...(Frozen config) > So seems to be ActionForm validating is not so flexible and cool :-)? Or > maybe application must use static pages where forms are located? > Of course I can do validation in action and achieve needed result > Opinion of experts? > Ilja. > > - > 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]
ActionForm validate and redirect
Hi I use validate method in one of my ActionForms, after validation is fail, method redirects browser to wahatever is set in struts-config.xml under input attribut... I faced problem that i need this value to be dynamic. (I want to redirect a user to same page from where form has been submitted but with error messages. And this page has query paramters :( ) Trying to call actionMapping.setInput("") gives exception...(Frozen config) So seems to be ActionForm validating is not so flexible and cool :-)? Or maybe application must use static pages where forms are located? Of course I can do validation in action and achieve needed result Opinion of experts? Ilja. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]