File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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 Soft Skills this week in the Jobs Discussion 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: 297

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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: use of first parameter in errors.add() method