struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jsad...@gpnus.mizuho-cb.com
Subject RE: nulls (and only nulls) in <html:errors/>
Date Tue, 13 Aug 2002 16:48:34 GMT


Keith, Fabio,

Thanks much. I tried adding the errors.footer, errors.header keys but,
unfortunately, it didn't work. (BTW, yes I did bounce Tomcat each time and
verify in the log file that the properties file was correctly loaded)

PLEASE, anyone who can give further help. I'm getting deperately frustrated and
frustratingly desperate. It seems like such a simple thing, but
fraught with so many problems.

I tried the following variations (complete contents of properties file):

VARIATION 1:
errors.footer=</ul><hr>
errors.header=<h3><font color="red">Validation Error</font></h3>You
must correct
 the following error
(s) before proceeding:<ul>
error.applname.required=<li>Application Name is required</li>
error.appldesc.required=there is nothing here

VARIATION 2:
errors.header=
errors.footer=
error.applname.required=<li>Application Name is required</li>
error.appldesc.required=there is nothing here


VARIATION 3:
error.applname.required=<li>Application Name is required</li>
error.appldesc.required=there is nothing here
errors.header=
errors.footer=

I have also been using GLOBAL_ERROR instead of a property name, since these
errors should appear at the top of the page and not associated with
any field:
errors.add(ActionErrors.GLOBAL_ERROR, new
ActionError("error.applname.required"));





"Kamholz, Keith (corp-staff) USX" <kkamholz@moog.com> on 08/13/2002 11:28:29 AM

Please respond to "Struts Users Mailing List" <struts-user@jakarta.apache.org>

To:   "'Struts Users Mailing List'" <struts-user@jakarta.apache.org>
cc:    (bcc: Joseph Sadove/DKBDS USA/DKB)

Subject:  RE: nulls (and only nulls) in <html:errors/>



Do you have errors.header and errors.footer defined in your properties file?

~ Keith
http://www.buffalo.edu/~kkamholz


-----Original Message-----
From: jsadove@gpnus.mizuho-cb.com [mailto:jsadove@gpnus.mizuho-cb.com]
Sent: Tuesday, August 13, 2002 11:27 AM
To: struts-user@jakarta.apache.org
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:struts-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail:
<mailto:struts-user-help@jakarta.apache.org>

--
To unsubscribe, e-mail:   <mailto:struts-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:struts-user-help@jakarta.apache.org>








--
To unsubscribe, e-mail:   <mailto:struts-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:struts-user-help@jakarta.apache.org>


Mime
View raw message