struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gunnar Hillert <gun...@hillert.com>
Subject [S2] ActionMessages and redirects
Date Mon, 04 Jun 2007 04:52:11 GMT

Hi,

Still learning but I am really going to like Struts 2. An area where I find
it a bit lacking though (Compared to Struts 1) is the support for action
messages to survive redirects. 

I really like to follow the ‘Post/Redirect/Get pattern’ for most of my
actions. 
(See also http://www.theserverside.com/patterns/thread.tss?thread_id=20936)

Therefore in most of my actions I have the requirement that my success
messages survive the next redirect.

In Struts 1 I can do:

messages.add(ActionMessages.GLOBAL_MESSAGE, 
                       new ActionMessage("user.added"));
saveMessages(request.getSession(), messages);

But there is nothing like this in Struts 2.

I did not find too much information about this requirement in Struts 2. 
There are 2 open issues in Jira that touch the issue:

https://issues.apache.org/struts/browse/WW-1623
https://issues.apache.org/struts/browse/WW-1572

On of the issues mentions the MessageStore interceptor but that looks a bit
like overkill to me… (See also
http://cwiki.apache.org/WW/message-store-interceptor.html)

Thus, for right now I am using Appfuse’s solution of using a custom filter. 
(See
https://appfuse-light.dev.java.net/source/browse/appfuse-light/trunk/src/main/java/org/appfuse/web/MessageFilter.java)

This works great but somehow feels like a ‘hack’ (Had to do the same for my
Spring MVC projects…)

* * *

In a perfect world I would like to see a feature similar to Ruby on Rails’
Flash which allows you to not only store messages but any object in a Flash,
and hence those objects survive the next redirect.

See also http://api.rubyonrails.com/classes/ActionController/Flash.html

But for the time being I would be already quite happy if there was a simple
and standardized way to have my actionMessages survive redirects.

What is the status on that? Is this something that will be added to one of
the next Struts 2 releases?

Thanks a lot! 

Regards,

Gunnar Hillert 

-- 
View this message in context: http://www.nabble.com/-S2--ActionMessages-and-redirects-tf3863054.html#a10943759
Sent from the Struts - User mailing list archive at Nabble.com.


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


Mime
View raw message