aspose file tools*
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
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Struts newbie question - bean:message" Watch "Struts newbie question - bean:message" New topic
Author

Struts newbie question - bean:message

Gyula Klinszky
Greenhorn

Joined: Jan 20, 2003
Posts: 27
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
Junilu Lacar
Bartender

Joined: Feb 26, 2001
Posts: 4462
    
    6

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:



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

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: http://aspose.com/file-tools
 
subject: Struts newbie question - bean:message