• Post Reply Bookmark Topic Watch Topic
  • New Topic

Multiple parameterized i18nable messages on a GET request  RSS feed

 
greg buela
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Looking for suggestions.
Say you process a request and your service or model produces a bunch of validation messages (for example, one for each required field that was left empty). These are message keys to be resolved through a i18n bundle. Say you may need to parameterize some messages, for example to inform the maximum size for a given field. So far so good.
Now, say that this request does not forward to a view, but issues a sendRedirect which triggers a GET from the client. This new request yields a view which should be capable of displaying the messages correctly. How would you go about doing this?
The easiest way out seems to be storing everything in the session scope so it's available in the next request. The new request should clear that stuff immediately after use.
Is there a better way?
Thanks!
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66260
151
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you don't want to pass the info in the query string, which is not well suited for anything but simple string data, then your session idea is a best bet. And yes, making sure to clear out stale session data is a grand idea.
 
greg buela
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Bear.
I try to keep usage of the session scope to a minimum and I thought that maybe this would already be too much.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66260
151
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The session is a valuable tool to be used wisely.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!