• 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

struts, error reporting

 
Ranch Hand
Posts: 209
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
<html:errors/> only display error messages returned from validate() method of FormAction class but not from execute() method of Action class.
How do I display ActionError that are created in execute() method of Action class?
LoginAction class
public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest req, HttpServletResponse res)
throws Exception {
UserManager um = UserManager.getInstance();
String username = ((LoginForm)form).getUsername();
String password = ((LoginForm)form).getPassword();
ActionErrors errors = null;
if (um.login(req.getSession(), username, password) == null) {
errors = new ActionErrors();
errors.add(ActionErrors.GLOBAL_ERROR, new ActionError("error.login.loginfailed"));
saveErrors(req, errors);
return mapping.findForward("Failure");

}
return mapping.findForward("Success");
}
[ September 10, 2002: Message edited by: Chu Tan ]
[ September 10, 2002: Message edited by: Chu Tan ]
 
Justin Chu
Ranch Hand
Posts: 209
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
FOund out the answer..
in execute() method,
return (new ActionForward(mapping.getInput())); // go home
instead of finding Action forward from the ActionMappings, makes me wonder why the "Failure" forward mapping.
 
Don't sweat petty things, or pet sweaty things. But cuddle 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