Hi,

public ActionErrors validate(ActionMapping actionMapping,
                        HttpServletRequest httpServletRequest) {

                ActionErrors errors = new ActionErrors();


             if ((username == null) || (username.length() == 0)) {
                 errors.add("username", new
        
org.apache.struts.action.ActionError("error.login.username"));
                  }
             
             if ((password == null) || (password.length() == 0)) {
                         errors.add("password", new
        
org.apache.struts.action.ActionError("error.login.password"));
                          }
         
             
                return errors;
        }

Add this code in your formbean. Ur formbean should extend ValidatorForm.

In Jsp. Add this code <html:errors/> in the jsp. It will be validation
will be displayed.


 regards,

Mansoor 

 

   


-----Original Message-----
From: Medicherla Lakshmi [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, June 20, 2006 6:16 PM
To: Struts Users Mailing List
Subject: ActionErrors not being displayed in jsp



HI,
   
  Can anyone please explain me how to validate a login page using
validate method of actionform.  Am not able to display the errors in my
jsp page though i wrote <html:errors/> in my jsp.  Please give any
example of using ActionErrors.
   
  Thanks and Regards,
  MSV Lakshmi.

                                
---------------------------------
  Yahoo! India Answers: Share what you know. Learn something new Click
here
 Send free SMS to your Friends on Mobile from your Yahoo! Messenger
Download now


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to