Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

ActionMessages.GLOBAL_MESSAGE ??

 
Maneesh Chauahn
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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

Regards,
Maneesh Chauhan
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic