• 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

Struts newbie question - bean:message

 
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

A newbie Struts question: I have a data processing action, which can update, insert, or delete a record, and forwards to a "success page", which contains a message indicating what happenened (= different message based on the type of action).
What solution would you suggest to display this message, which is coming from a ResourceBundle (3 entries, one for insert, one for update, one for delete) ? I was trying for one bean:message, but the only solution I came up with was using Java scriptlet...

Thanks in advance, and sorry if the answer is obvious
 
Sheriff
Posts: 17644
300
Mac Android IntelliJ IDE Eclipse IDE Spring Debian Java Ubuntu Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can use the html:messages tag to do this.



You can do the same for other types of messages by changing "errormsg" to something else. What I did for my current project was to have a fixed set of message types, defined those types as constants and put all the code to display in one JSP. That way, other developers simply had to include the one JSP in the appropriate place in their page. This made the display of messages consistent throughout the application and also made maintenance a breeze: if we needed to change something, we just changed the one JSP.

Example:

 
Gyula Klinszky
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you, Junilu, that is what I have been looking for. Of course having read about ActionMessages before, I feel somewhat stupid
 
You're not going crazy. You're going sane in a crazy word. Find comfort in this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic