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

How to ActionErrors and ActionError

 
Gopnan
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Firends,
I am new to struts application. I don't know what is use ActionErrors and ActionError and how to use this Errors in our Struts application .Anybody help to me. Give a sample code for how to use this.
 
John Melton
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
ActionErrors is just a way to do validation and get errors onto the JSP page for display. For the most part now you can use ActionMessages instead of ActionErrors. Here's a simple example. From your action, write these lines:



In the ApplicationResources.properties file (your messages file), you'd have to put a message in for "my.error.something", or whatever you called your error, then on the jsp page, use thes lines

 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Gopnan,

Please change the publicly displayed name on your profile so that it conforms to the JavaRanch Naming Policy.

Failure to do so may result in your profile being removed.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic