• 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

Generating "user not found" logon error messages

 
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I've got the rudiments of a login going, and I've got the simple error messages working ("Username is required" -- via DynaActionForm and the validation plugin). Now, within my action class, I need to generate errors that are determined by DB interaction, like:

"User not found"
"Invalid password"
or
"Databaes unavailable. Try again later."

I'm not sure how to feed those errors back into the validation framework. Could someone explain, please?

Thanks,
Jamie
 
Ranch Hand
Posts: 147
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You don't display those errors through Validation.xml ,as they are not Validation errors.
YOu have to either use ActionMessages or ActionErrors and add those messages into that object and display it on the browser.
 
pie sneak
Posts: 4727
Mac VI Editor Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes, this is beyond the validation framework.

The error does not happen until the Action, so you'll have to handle it in the action. Just add the error to ActionErrors there and don't forget to call the saveErrors() method.
 
Ranch Hand
Posts: 341
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
saveErrors(HttpServletRequest, ActionErrors) is deprecated in Struts1.2.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic