File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Struts and the fly likes Struts newbie question - bean:message Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Struts newbie question - bean:message" Watch "Struts newbie question - bean:message" New topic

Struts newbie question - bean:message

Gyula Klinszky

Joined: Jan 20, 2003
Posts: 27

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
Junilu Lacar

Joined: Feb 26, 2001
Posts: 6529

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.


Junilu - [How to Ask Questions] [How to Answer Questions]
Gyula Klinszky

Joined: Jan 20, 2003
Posts: 27
Thank you, Junilu, that is what I have been looking for. Of course having read about ActionMessages before, I feel somewhat stupid
I agree. Here's the link:
subject: Struts newbie question - bean:message
It's not a secret anymore!