aspose file tools*
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 Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "ActionErrors or ActionMessages ?" Watch "ActionErrors or ActionMessages ?" New topic
Author

ActionErrors or ActionMessages ?

Ja vardhan
Ranch Hand

Joined: May 09, 2005
Posts: 169
Hi,

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..
Thanks.


Javardhan:
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.


Merrill
Consultant, Sima Solutions
Ja vardhan
Ranch Hand

Joined: May 09, 2005
Posts: 169
Merrill,

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?

Thanks.
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
http://www.coderanch.com/t/55144/Struts/Custom-Validations-Struts-Validator-Framework


Regards, Manish
SCJP 1.4
 
Don't get me started about those stupid light bulbs.
 
subject: ActionErrors or ActionMessages ?
 
Similar Threads
validate() ActionForm : ActionErrors or ActionMessages ?
ActionErrors vs ActionMessages
ActionMessages in STRUTS 1.1 Please help !!!
Validator framework is not working
Changing ActionErrors to ActionMessages in struts application