This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Struts and the fly likes Generating Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Generating "user not found" logon error messages" Watch "Generating "user not found" logon error messages" New topic

Generating "user not found" logon error messages

Jamie Jackson
Ranch Hand

Joined: Jan 11, 2005
Posts: 58
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"
"Databaes unavailable. Try again later."

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

Archana Annamaneni
Ranch Hand

Joined: Jan 29, 2003
Posts: 147
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

Joined: Feb 05, 2003
Posts: 4727

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.

A good workman is known by his tools.
Surasak Leenapongpanit
Ranch Hand

Joined: May 10, 2002
Posts: 341
saveErrors(HttpServletRequest, ActionErrors) is deprecated in Struts1.2.
jQuery in Action, 2nd edition
subject: Generating "user not found" logon error messages
Similar Threads
Ajax Error Handling
Validation messages - FacesMessages
Choosing frameworks etc...
FacesMessages and valueChangeListener with immediate="true"
t:inputDate and custom validation