Hi jim

here is the snippet from struts-config.xml

    <action    path="/logon"
               type="prototype.beans.LogonAction"
               name="logonForm"
               validate="true"
               scope="request"
               input="index">
      <forward name="success" path="/main.jsp"/>
     
    </action>

and here is the snippet from LogonForm



    public ActionErrors validate(ActionMapping actionMapping,
HttpServletRequest request) 
    {
        ActionErrors errors = new ActionErrors(); 
        if(getName().trim().equals("") || getName()==null)
            errors.add("name",new ActionError("errors.name.required"));
        if(getPassword().trim().equals("") || getPassword()==null)
            errors.add("password",new ActionError("errors.passwd.required"));
        
        return errors; 
        
    }

and here is relevant portion of jsp

<html:html locale="true">
<head>
<title><bean:message key="logon.title"/></title>
<html:base/>
</head>
<body bgcolor="white">

<html:errors/>
<div align="center">
<h3><bean:message key="logon.heading"/></h3>
</div>
<html:form action="/logon"> 
<table border="0" width="100%">

  .....table information

</table>

</html:form>

</body>
</html:html>

regards
saurabh



On Mon, 2004-08-30 at 16:31, Jim Barrows wrote:
> > -----Original Message-----
> > From: Saurabh Bhatla [mailto:[EMAIL PROTECTED]
> > Sent: Monday, August 30, 2004 2:29 PM
> > To: struts
> > Subject: validate in ActionForm not working for errors
> > 
> > 
> > hi all,
> >     I have a simple form that takes username and passwd. for 
> > that i have
> > a LogonForm bean, which has a validate method. if i enter 
> > both username
> > and passwd it works fine and gets forwarded to the next page. but if
> > there is an error in validate() and ActionErrors object is 
> > returned then
> > my control goes to a blank page. I know that my ActionErrors 
> > object has
> > been populated as i have checked it with debug statements. 'input'
> > property in my action mapping is to index.jsp, that is the 
> > page itself.
> > why is it showing me a blank page. why is the framework not 
> > showing any
> > exception if there is one. 
> > 
> > any suggestions
> 
> could you show us the relevant portions of your struts-config.xml, index.jsp and the 
> validate method?
> Given what you said it's probably a typo, or something very subtle.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 


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

Reply via email to