*
The moose likes Struts and the fly likes use of first parameter in errors.add() method 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 "use of first parameter in errors.add() method" Watch "use of first parameter in errors.add() method" New topic
Author

use of first parameter in errors.add() method

Sameer Raza Ali
Greenhorn

Joined: Oct 15, 2009
Posts: 20
what is the use of the first parameter in errors.add() method


SCJP 1.4 , SCWCD 5.0
jatan bhavsar
Ranch Hand

Joined: Jul 23, 2008
Posts: 296

Hi Sameer,

Key represents the value from the form . suppose there is something wrong with the userid then you can set the action error like
"errors.add("userid",new ActionMessage("error.invalid.userid"));"

Refer This Link. Which will solve your doubt.

Regards
Jatan
Sameer Raza Ali
Greenhorn

Joined: Oct 15, 2009
Posts: 20
Hi Jatan Thanks for your quick response i got your point the paragraph below gives the answer

You can also use to display a particular message based on the key used when it was added to the ActionErrors object. This is useful if you want to display the message next to the field causing the error.

Regards
Sameer
 
 
subject: use of first parameter in errors.add() method
 
Similar Threads
Validate() method not showing the validate messages
html:error to print specific error
how to invoke errors.clear() from javascript
Server side Integer fields validation in Struts 1.1
validation error msg with properties file