Why does your validate() method have

if ( errors.empty() ) {
            return null;
 }

You should not have to do that.  Try removing it.  

Sri

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, August 13, 2002 11:27 AM
To: [EMAIL PROTECTED]
Subject: nulls (and only nulls) in <html:errors/>




I am running 1.02 of Struts on Tomcat 4.04.
I get nulls returned to my JSP when trying to set errors in an ActionForm. I have 
scoured the mailing lists and have found lots of people getting nulls on either side 
of the error strings (apparently a Weblogic thing) and there are people getting 
nothing, seemingly no one getting the string "null".

I will be vastly grateful to anyone who can help.
(Until this problem, I have thought struts --with Arron Bates nested
extensions-- were right up there next to sliced bread. Please help me preserve the 
glow!) I've appended below all the useful bits of code, I think.

Here are the contents of ApplicationResources.properties file:

error.applname.required=<li>Application Name is required</li> 
error.appldesc.required=there is nothing here

Here are the relevant parts of the struts config file:

BEGIN CODE
  <!-- bean definition -->
  <form-beans>
     <form-bean name="NewApplicationBean" 
type="dkb.irmis.struts.beans.NewApplicationBean" /> ....
  </form-beans>

  <!-- forwards -->
...
  </global-forwards>


  <!-- actions -->
  <action-mappings>
....
    <action path="/NewApp" type="dkb.irmis.struts.actions.NewAppAction"
      name="NewApplicationBean"
            input="/new_application.jsp"
      scope="session">
      <forward name="newappform" path="/new_application.jsp"/>
    </action>
....
  </action-mappings>
</struts-config>
END CODE

And here is the validate method:
BEGIN CODE
     public ActionErrors validate(ActionMapping mapping, HttpServletRequest
request) {

          ActionErrors errors = new ActionErrors();

    if (addApplications.equals("ADD Applications") ) {
     addApplications = "RESET Values";
         for (int i = 0; i < applicationList.size(); i++) {
                    if (
((NewApplicationObj)applicationList.get(i)).getApplicationDesc().length() > 0  )  {

                          if(
((NewApplicationObj)applicationList.get(i)).getApplicationName() == null ||
((NewApplicationObj)applicationList.get(i)).getApplicationName().length() < 1 )
  {

                                   errors.add("applname", new
ActionError("error.applname.required") );

                         }
                      }
       }
     }

if ( errors.empty() ) {
            return null;
 }
 return errors;

} // end validate
END CODE






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

Reply via email to