Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

ActionErrors or ActionMessages ?

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