• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to acess ActionErrors in Action

 
Ranch Hand
Posts: 141
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
ya i myself found that key its Globals.ERROR_KEY.now working fine...
 
Ranch Hand
Posts: 96
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 181
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
<html:errors/> should do the trick.
 
raj baig
Ranch Hand
Posts: 96
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Blood pressure normal? What do I change to get "magnificent"? Maybe this tiny ad?
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic