struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Guillaume Bilodeau <>
Subject RE: Is there such a thing as flash in S2?
Date Thu, 05 Jun 2008 13:49:20 GMT

Great!  I'm glad it worked fine.  I'll merge your documentation additions as
soon as I have a moment, thanks for providing them.

I like your idea of generating multiple flash map IDs, it seems like a good
solution would make the implementation more flexible.  Feel free to modify
the code and upload it here - again if I have some time I'll try to have a
look at it also.

As for setting a timeout value on the flash map, the idea's interesting but
I think it would only delay the problem.  Sure putting a 60-second delay on
the map would allow it to survive to quick refreshes, but it wouldn't solve
the case when a user returns to this page later using the back button; plus
it would be possible to clog the session with long-lived flash maps if not
used correctly.  On the other hand, maybe it would solve enough cases to
motivate adding this functionality; plus giving a choice to the developer
can be a good thing.  Maybe the Struts2 seniors would like to give their
opinion on this?

To implement this I'd have the result add a timestamp to the map and the
interceptor check for the timestamp's validity instead of starting a timer
though, it would be much lighter.


kenk wrote:
> GB,
> I've finished implementing my use case using your FlashInterceptor and
> FlashResult -- it worked perfectly and I didn't need to change anything in
> your code.  :clap:  
> But it did take me a while to achieve success, mainly owing to my newness
> to Struts 2 and the difficulty I've had following the S2 documentation. 
> So having said that, I have uploaded some revisions to your JavaDocs, in
> hopes that they will help other newbies dealing with the whole flash scope
> issue, perhaps you can add these.
> The main feedback item I have on the code is the hard-coded "__flashMap"
> key on the session -- this limits you to one flash scope at a time.  How
> about having the FlashResult generate a random key value ( i.e.
> __flashMap_xxxxx ), send this as a request parameter, have the
> FlashInterceptor detect this value and use it to access the map.  Poof! 
> No more issue with multiple browser windows open.
> For the refresh issue, have an optional configuration parameter on the
> FlashInterceptor called "flashMapTimeout", defaulting to 60 seconds. 
> Instead of immediately removing the flash map from the session, start a
> java.util.Timer and remove it later.  Poof!  Now the refresh works (until
> the timeout occurs).
> Thanks again for making your code available!
> Ken
> JavaDocAdditions.txt 

View this message in context:
Sent from the Struts - User mailing list archive at

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message