• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Multiple parameterized i18nable messages on a GET request

 
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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!
 
Sheriff
Posts: 67747
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Sheriff
Posts: 67747
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The session is a valuable tool to be used wisely.
reply
    Bookmark Topic Watch Topic
  • New Topic