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

Generating "user not found" logon error messages

 
Jamie Jackson
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
  • 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
 
Archana Annamaneni
Ranch Hand
Posts: 147
  • Mark post as helpful
  • send pies
  • 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.
 
Marc Peabody
pie sneak
Sheriff
Posts: 4727
Mac Ruby VI Editor
  • Mark post as helpful
  • send pies
  • 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.
 
Surasak Leenapongpanit
Ranch Hand
Posts: 341
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
saveErrors(HttpServletRequest, ActionErrors) is deprecated in Struts1.2.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic