This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Struts and the fly likes ActionErrors or ActionMessages ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "ActionErrors or ActionMessages ?" Watch "ActionErrors or ActionMessages ?" New topic

ActionErrors or ActionMessages ?

Ja vardhan
Ranch Hand

Joined: May 09, 2005
Posts: 169

Whats the differance between ActionErrors and ActionMessages ?
When we go for ActionErrors and when we go for ActionMessages ?

In some validator-rules.xml files I have seen passing ActionErrors and in some files I have seen ActionMessages.

Pls tell me what would happen in both the cases..

Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
Since ActionErrors is a subclass of ActionMessages, any method that requires an ActionMessages parameter can be passed an ActionErrors object and it will be automatically cast to an ActionMessages object.

There's very little difference between the two, and for the most part they can be used interchangeably.

Consultant, Sima Solutions
Ja vardhan
Ranch Hand

Joined: May 09, 2005
Posts: 169

Thanks for replying my queries..

In my application, I have written Java class for custom validation and validate method is like this:

And I am passing ActionErrors from validator-rules.xml like this:

But in my validate method ActionErrors is coming as null.
If I use ActionMessages its working fine.

Whats the problem with ActionErrors?

M Sharma
Ranch Hand

Joined: Dec 13, 2001
Posts: 106
Hi Javardhan,

I faced similar problem and got a solution to it.

You can view the solution at

Regards, Manish
SCJP 1.4
I agree. Here's the link:
subject: ActionErrors or ActionMessages ?
Similar Threads
Validator framework is not working
ActionMessages in STRUTS 1.1 Please help !!!
Changing ActionErrors to ActionMessages in struts application
validate() ActionForm : ActionErrors or ActionMessages ?
ActionErrors vs ActionMessages