permaculture playing cards
The moose likes Struts and the fly likes ActionMessages.GLOBAL_MESSAGE ?? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "ActionMessages.GLOBAL_MESSAGE ??" Watch "ActionMessages.GLOBAL_MESSAGE ??" New topic

ActionMessages.GLOBAL_MESSAGE ??

Maneesh Chauahn
Ranch Hand

Joined: Mar 06, 2006
Posts: 48
Hi All,
I have a question on the ActionMessages , as this class contains the ActionMesaage class object which is used to show the error message . We put the ActionMessage class in the ActionMessages class
like ActionMessages.add(ActionMessages.GLOBAL_MESSAGE,new ActionMessage("errorMessage"))

Now my question is that What is the Significance of ActionMessages.GLOBAL_MESSAGE and can i use any String instead of ActionMeassage.GLOBAL_MESSAGE

Thanks in advance for your prompt answer

Maneesh Chauhan
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
Specifying ActionMessages.GLOBAL_MESSAGE is the standard way of indicating that the message is not attached to a particular input field or property. If you do wish to attach an error message to a property, it is appropriate to specify the property name instead. This name can then be used in either the <html:errors> or <html:messages> tag to show only the message for that particular property. Example:

In your Action class:

In your JSP:

In this case, even if there are other messages present, only the "birthDate" message will be displayed.

Consultant, Sima Solutions
I agree. Here's the link:
subject: ActionMessages.GLOBAL_MESSAGE ??
It's not a secret anymore!