Hi guys,

I have just developed a FlashResult / FlashInterceptor pair - turns out it
wasn't that difficult.  I couldn't give it much testing (for the moment the
only use case in my application that requires flash scope is showing success
messages following a redirect) but for what it's worth it seems to work
fine.  Unit tests are also conclusive.

The FlashResult basically works like the ServletActionRedirectResult except
that instead of converting all extra parameters to strings and adding them
as HTTP parameters in the redirect URL, it creates a HashMap using these
parameter key/value pairs with no conversion and stores it in the user
session.  On the next HTTP request the FlashInterceptor, if properly added
to the interceptor stack, will retrieve this map and copy the map entries to
the target action using the parameter keys.  It should work for all data
types.

To function correctly this approach assumes that bug WW-2170 is fixed.  The
implementation also borrows a lot from the ServletActionRedirectResult and
some refactoring should be done.

Is there a place where I can upload the code so that you guys can check it
out and give me some feedback?  I think this could make a nice addition to
the Struts2 code base.

Cheers,
GB


Brad A Cupit wrote:
> 
>>> This hypothetical flash result could list the properties
>>> that should survive the redirect
>>> <snip/>
>>> I'll investigate writing such a result / interceptor pair.  
> 
> Wouldn't that be the same as the ServletActionRedirectResult, where
> param values can be ognl expressions? (assuming a version of struts 2
> where bug WW-2170 is fixed).
> 
> Now, if this result/interceptor pair instead reads annotations on
> properties in the action, or, if it stores the results in the session
> (and then removed them on the next request) rather than as parameters in
> the url, then it definitely is different from
> ServletActionRedirectResult.
> 
> Having said that, I question using the session, since
> redirect-after-post was designed to help alleviate back and refresh
> button problems. If we store information in the session for the
> redirect, then the first GET will find that information, but subsequent
> GETs (perhaps the result of pressing back or refresh) will not find that
> information, so the GET will have been inconsistent.
> 
> I guess this just pertains to flash scope in general though, and not any
> particular implementation.
> 
> Brad Cupit
> Louisiana State University - UIS
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Is-there-such-a-thing-as-flash-in-S2--tp16697840p16866433.html
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to