You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Toni Lyytikäinen <to...@gmail.com> on 2007/06/29 16:09:48 UTC
How to pass messages that survive redirects?
I've used to doing something like this in Ruby on Rails:
if @object.updateAttributes(params[:object])
flash[:notice]="Update succesful!"
redirect_to :action=>'list'
else ...
Now that I'm using Struts 2 for a project I tried doing something similar:
try {
objectService.save(getObject());
addActionMessage("Update succesful!");
return "redirect";
} catch (...)
But I found out that the actionmessages don't show in the redirected action
anymore (probably because then it's another instance of that class that
doesn't have the same actionmessages property), even though I have the
<s:actionmessage />-tag. Is there a mechanism to pass messages from actions
that survive a redirect? Or should I just put them into the users session?
Re: How to pass messages that survive redirects?
Posted by Dave Newton <ne...@yahoo.com>.
--- Christopher Schultz wrote:
> Toni Lyytikäinen wrote:
>> Is there a mechanism to pass messages from actions
>> that survive a redirect? Or should I just put them
>> into the users session?
> The session or the URL of the target page are really
> the only ways to do this.
http://struts.apache.org/2.x/docs/message-store-interceptor.html
does it a bit more automagically, though.
d.
____________________________________________________________________________________
Fussy? Opinionated? Impossible to please? Perfect. Join Yahoo!'s user panel and lay it on us. http://surveylink.yahoo.com/gmrs/yahoo_panel_invite.asp?a=7
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: How to pass messages that survive redirects?
Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Toni,
Toni Lyytikäinen wrote:
> Is there a mechanism to pass messages from actions that survive a
> redirect? Or should I just put them into the users session?
The session or the URL of the target page are really the only ways to do
this.
- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD4DBQFGhS1z9CaO5/Lv0PARAn+aAJj9LswkCnQb8fKRagVvmZFGoIxaAJ9iDLR/
ue4kKAlbxRGRYSItq6gLZg==
=RRqX
-----END PGP SIGNATURE-----
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org