• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to acess ActionErrors in Action

 
vijay saraf
Ranch Hand
Posts: 141
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello All,

I am bit confused with action errors;
see AcrionErrors generally prepared by validate method,and in validate method i don't want to put any database check-up,for a case if user logs in to system and validate method passes all check like required,minlength etc.
but for existance in to data base i have to check in the action and if user not found then i have to prepare actionerrors.
so the question is how can i prepare actionerrors in action ?
i am using 1.2.9 version (with netbeans 5.5)
and if some one is thinking that solution is as bellow


ActionErrors ae = new ActionErrors( );
ae.add("userId", new ActionError("error.invalid.login"));
request.setAttribute(Action.ERROR_KEY, ae);


it is not working , i think Action.ERROR_KEY is not present there.
can any one help me ?
 
vijay saraf
Ranch Hand
Posts: 141
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ya i myself found that key its Globals.ERROR_KEY.now working fine...
 
raj baig
Ranch Hand
Posts: 96
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi vijay , all

great for sharing the information with all.
i would like to know how to display the error massages .
you stored the ActionErrors Object in request.

do we need to display in jsp. or the server will display.
 
Dom Lassy
Ranch Hand
Posts: 181
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
<html:errors/> should do the trick.
 
raj baig
Ranch Hand
Posts: 96
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi dom,
Thank you for reply.
i understood your reply. but i would like to know how the errors will
display when an error occur in action class.

please be some more specific.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic