Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

ActionMessage

 
jonathan Greens
Ranch Hand
Posts: 139
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
does struts also provide framework for displaying messages similiar to that of displaying errors?
errors.add(ActionErrors.GLOBAL_ERROR,new ActionError(..));
<html:errors/>
Also what is the meaing of ActionErrors.GLOBAL_ERROR, what other keys can I specify here..
thanks in advance!
 
sreenath reddy
Ranch Hand
Posts: 415
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi

ActionError deosnt mean that u can display only errors with that .u can use it for any messages......to avoid this false assumption they came up with ActionMessages in 1.1 and ActionErrors is deprecated and even removed in 1.2 version of struts

Action messages is like a Hashmap with key as some string and value being the
List of messages u add in that category .that ActionErrors.ERROR_KEY is the constant u r suing to store the errors in thatkey

this key comcept willbe essential if u want to display the error realted to a particlkaur field adjacent to that instead of diaplying all the errors in the page in one shot
 
jonathan Greens
Ranch Hand
Posts: 139
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
so I can use ActionErrors to display non-error messages?
thanks!
 
Nathan Hook
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I actually have a question about this topic.

If ActionErrors are being depricated then why are they still in the validation framework? I don't get it.

It makes it difficult inside of the JSP's to display both action errors and action messages from the examples I've seen.

Can anyone shed some light on this for me?

Regards,

Nate
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic