• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

ActionErrors or ActionMessages ?

 
Ranch Hand
Posts: 169
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 106
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Javardhan,

I faced similar problem and got a solution to it.

You can view the solution at
https://coderanch.com/t/55144/Struts/Custom-Validations-Struts-Validator-Framework
 
A "dutch baby" is not a baby. But this tiny ad is baby sized:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic