You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by ashokd <as...@visualsoft-tech.com> on 2002/05/02 17:44:32 UTC

Re: Help needed

MessageHi,

If we displayed <html:errors> tag, All errors will display.

If we want appropirate error we would get by using key (errors.add( "userName", new ActionError("invalid.login") );)

In above example userName is the key to get appropriage error message corresponding.

In API we have method on ActionError class, to get this.

Thanks & Regards,
Ashok.D
  ----- Original Message ----- 
  From: C.Bhaskaran 
  To: 'Struts Users Mailing List' ; suresh.addagalla@wipro.com 
  Sent: Monday, January 06, 2003 4:42 PM
  Subject: RE: Help needed


  put <html:errors> tag
    -----Original Message-----
    From: Suresh Addagalla [mailto:suresh.addagalla@wipro.com] 
    Sent: Monday, January 06, 2003 4:30 PM
    To: struts-user@jakarta.apache.org
    Subject: Help needed


    Hi,

    I have a login page. If the login fails, I want to show the errors next to the specific field (if username is wrong, the error is shown next to username field, etc.) I am using programmatic exception handling.

            try {
                service.authenticate(userName, password) ;
            } catch (InvalidLoginException ile) {
                  
                  System.out.println("adding action errors in action class") ;
                  
                  ActionErrors errors = new ActionErrors();
                  errors.add( "userName", new ActionError("invalid.login") );
                  saveErrors( request, errors );
                  
                  return mapping.findForward("Failure") ;
            }

    How should I access these errors in my JSP to show the errors?

    Thanks,
    Suresh


------------------------------------------------------------------------------


  --
  To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
  For additional commands, e-mail: <ma...@jakarta.apache.org>