This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Agile forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

use of first parameter in errors.add() method

 
Sameer Raza Ali
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
what is the use of the first parameter in errors.add() method
 
jatan bhavsar
Ranch Hand
Posts: 299
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic