Hi,

FlashScope is meant to be used for the Redirect-After-Post pattern, basically :
1) ActionBean changes something on the server (usually database).
2) ActionBean redirects to another/same ActionBean to prevent double submit if 
user press refresh. Current ActionBean wants to save information for the other 
ActionBean.

What you want to do seems to be to save information for the JSP after a Forward.
In such cases, save information in the Request instead.

Christian

-----Message d'origine-----
De : James Walker [mailto:misterwal...@hotmail.com] 
Envoyé : February-21-13 11:23 AM
À : stripes-users@lists.sourceforge.net
Objet : [Stripes-users] FlashScope

I am trying to temporarily save data on the server side. If possible, I would 
prefer to use FlashScope rather than the session since I only want to save the 
data temporarily. But I have just not had any luck retrieving anything that I 
have saved to the FlashScope. If it helps, I can provide my use case and 
reasoning, but this post is long enough already :)

I have read the following and will be referring to them below:
Stripes state management article: 
http://www.stripesframework.org/display/stripes/State+Management
FlashScope API documentation: 
http://stripes.sourceforge.net/docs/current/javadoc/net/sourceforge/stripes/con
troller/FlashScope.html
Stripes book: Stripes... and Java web development is fun again

A method in my ActionBean returns a ForwardResolution to a JSP. So the first 
thing I tried was saving a String parameter to the FlashScope, but I couldn't 
retrieve that FlashScope in another method of my ActionBean that is invoked by 
the JSP, even if I add the FlashScope key as a parameter to the 
ForwardResolution.

Since FlashScope documentation talks about redirects, I decided to try changing 
my ForwardResolution to a RedirectResolution. I could not successfully redirect 
to my JSP with the RedirectResolution (need to investigate), so I had the 
RedirectResolution redirect to an ActionBean method which returns a 
ForwardResolution to the JSP. I tried both saving the String parameter to the 
FlashScope as before and flashing the ActionBean instance by appending 
.flash(this) to the RedirectResolution, but still no luck.

I noticed the state management article states, "If you redirect to an 
ActionBean that forwards to a JSP, the flashed ActionBean will be overwritten 
with the ActionBean you redirected to", so that probably explains my issues. 
But the Stripes book discourages redirecting to a JSP because it breaks the 
preaction pattern. 

Is redirecting to a JSP the only way to use the FlashScope? If so doesn't that 
mean the FlashScope would only be available in the JSP? I would like to get to 
it in my ActionBean. And if possible I would really like to use it with a 
ForwardResolution. My ActionBean methods typically return a ForwardResolution 
unless they modify the database in which case they would return a 
RedirectResolution.

Any help would be appreciated. Thanks!


------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics Download AppDynamics Lite for free 
today:
http://p.sf.net/sfu/appdyn_d2d_feb
_______________________________________________
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users

------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_feb
_______________________________________________
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users

Reply via email to