Greg,

Thanks for the reply.  In going through the tag reference, I find I can also 
say "action=SomeOther" and that will also redirect to that action class without 
hitting the execute() method.  I didn't know about putting a redirect-action in 
the "name" field so I'm going to try a few different things to see how 
everything reacts.

Thanks again.
Dennis






________________________________
From: Greg Lindholm <greg.lindh...@gmail.com>
To: Struts Users Mailing List <user@struts.apache.org>
Sent: Tuesday, September 22, 2009 11:30:29 AM
Subject: Re: How to prevent validations from running?

If you want to avoid going the the "execute" method then you can use a
feature of DefaultActionMapper [1] and the submit button like this:

<s:submit key="Code.action.cancel" name="redirect-action:CodeList" />

This will cause a redirect to another action, in this example "CodeList".

Or you can specify an alternate "execute" Method or Action on the submit
button [2]

<s:submit key="xxx" method="AlternateMethod" />
<s:submit key="xxx" action="AlternateAction" />


[1]
http://struts.apache.org/2.1.6/struts2-core/apidocs/org/apache/struts2/dispatcher/mapper/DefaultActionMapper.html
[2] http://struts.apache.org/2.1.6/docs/submit.html


On Tue, Sep 22, 2009 at 11:10 AM, Dennis Atkinson <
dennisatkinson...@yahoo.com> wrote:

> Hi Greg.
>
> I am running Struts2; sorry I did not include that.
>
> The button is not causing a redirect; tt is invoking the "execute" method
> in the action class, and then the action class determines that  button was
> pressed, and then returns the string "list", which the struts.xml file then
> uses to redirect to another action class.  Except that never happens because
> the validation is done first.
>
>
>
>
>
> ________________________________
> From: Greg Lindholm <greg.lindh...@gmail.com>
> To: Struts Users Mailing List <user@struts.apache.org>
> Sent: Tuesday, September 22, 2009 10:49:06 AM
> Subject: Re: How to prevent validations from running?
>
> Are you running Struts 1 or 2?
>
> How is your button causing a redirect?
>
> On Tue, Sep 22, 2009 at 10:00 AM, Dennis Atkinson <
> dennisatkinson...@yahoo.com> wrote:
>
> > Hi all.
> >
> > I have a data entry page with a button to redirect to another page.
> >  Problem is, pressing that button causes all validations to run on every
> > field in the page.  I want to immediately get away from that page without
> > having to enter data.
> >
> > I know that if I redirect to the "input" method, the validations don't
> run.
> >  But whatever other method I call, the validations are always run.  Could
> > someone tell me how to do this?  Are there other methods I could call?
>  Or
> > is there a parameter I can set that I haven't found yet?
> >
> > Thanks in advance,
> > Dennis
> >
> >
> >
>
>
>
>
>



      

Reply via email to