You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Michael Jouravlev <jm...@gmail.com> on 2006/03/29 00:27:56 UTC
Messages in session scope / flash scope
Struts automatically removes messages from session scope after they
were shown. This is good, but what if I have store messages under a
key different from Globals.MESSAGE_KEY and Globals.ERROR_KEY? (I want
to use different keys because I have different sections on a page, or
for Ajax regions, so I need to separate error messages for each
section).
The easiest solution would be to define a static non-final ArrayList
or just an array right in the Globals class like this:
String[] FLASH_MSGS = new String[] {Globals.MESSAGE_KEY, Globals.ERROR_KEY};
Then users would be able customize this array in their applications,
adding more keys they use. Then processCachedMessages() would simply
iterate over array and remove messages.
Creating a whole new FlashScope object would be more complex, but
would allow to not define flash IDs beforehand.
By the way, processCachedMessages() is marked as "@since Struts 1.2".
Wow, I thought that this feature appeared in 1.2.6.
If there is interest for this, I can open a Bugzilla ticket and
prepare a patch. Which solution is better? Maybe someone wants to
suggest a different one.
Michael.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org