struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Greg Lindholm <greg.lindh...@gmail.com>
Subject Re: Problem with Validation "lifecycle"
Date Fri, 19 Nov 2010 16:43:15 GMT
I wrote this to solve the problem of preserving messages across a redirect:

http://glindholm.wordpress.com/2008/07/02/preserving-messages-across-a-redirect-in-struts-2/


On Fri, Nov 19, 2010 at 11:36 AM, Greg Akins <angrygreg@gmail.com> wrote:
> Thanks for the response
>
> On Fri, Nov 19, 2010 at 11:28 AM, Maurizio Cucchiara
> <maurizio.cucchiara@gmail.com> wrote:
>> As far I can remember actionError are stored in struts stack, so I guess
>> they are per-request.
>
> That's what I thought.
>
>> Also, redirect action create a new request, so you can share AE in a
>> standard flow.
>
> I CAN share actionErrors in the standard flow, but if I use
> redirectAction I lose the original request, right?
>
>> Can't you do without redirect for the input result?
>
> The problems is that when I create the jsp, I set values for whether
> the fields are to be displayed.  Since those are set in the action, if
> I skip that action the fields are displayed.
>
> The only other thing I can think of is to set the display in the other
> action (the one that is redirecting from).. but since I'm falling out
> of the interceptor stack and not getting into the execute method on
> the action, I'm not sure of how I'd do that either.
>
>> 2010/11/19 Greg Akins <angrygreg@gmail.com>
>>>
>>> I've written an action, with validation, that uses a redirectAction
>>> instead of a .jsp for the INPUT result.
>>>
>>> When the final INPUT jsp is displayed, the actionErrors aren't
>>> present.  I believe this is because the action I'm redirecting to
>>> "clears" the actions before the jsp is displayed.  If I save an
>>> actionError on the session, I can retrieve it in the final error...
>>> but this seems less than ideal, and I'm not sure how to get to the
>>> annotation based validators ( I added a session.put() in the
>>> validate() method.
>>>
>>> Is there a way to "carry" the errors across actions in this case? The
>>> INPUT needs to redirect to an action because the action determines
>>> whether certain fields need displayed.. if the INPUT goes straight to
>>> a jsp, the jsp is blank because of the logic I'm using to display
>>> fields.
>>>
>>> Struts 2.2.1
>>>
>>> --
>>> Greg Akins
>>>
>>> http://insomnia-consulting.org
>>> http://www.pghcodingdojo.org
>>> http://pittjug.dev.java.net
>>> http://twitter.com/akinsgre
>>> http://www.linkedin.com/in/akinsgre
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>>> For additional commands, e-mail: user-help@struts.apache.org
>>>
>>
>>
>>
>> --
>> Maurizio Cucchiara
>>
>
>
>
> --
> Greg Akins
>
> http://insomnia-consulting.org
> http://www.pghcodingdojo.org
> http://pittjug.dev.java.net
> http://twitter.com/akinsgre
> http://www.linkedin.com/in/akinsgre
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message