Hi Team Gasoline,

I found that I had to change the ErrorsTag to fix
this.

Try changing the following lines in the doStartTag()
method of org.apache.struts.taglib.hmtl.ErrorsTag

       // Render header iff this is a global tag or
there is an error for this property
       boolean propertyMsgPresent = reports.hasNext();

       if ((message != null)&&(property == null) ||
propertyMsgPresent) {
           results.append(message);
           results.append("\r\n");
       }

to:

       // Render header iff this is a global tag or
there is an error for this property
       boolean propertyMsgPresent = reports.hasNext();
       if ((message != null)&&(property == null) ||
propertyMsgPresent&&(property != null)) {
           results.append(message);
           results.append("\r\n");
       }

and a little lower down change this:

    if ((message != null)&&(property == null) ||
propertyMsgPresent) {
            results.append(message);
            results.append("\r\n");
        }

to:

    if ((message != null)&&(property == null) ||
propertyMsgPresent&&(property != null)) {
            results.append(message);
            results.append("\r\n");
        }

Hope that fills your tank!

Adrian

 --- Team Gasoline <[EMAIL PROTECTED]> wrote:
> I am reposting my request for help regarding "null"
> 's showing up when 
> my page is rendered. It is happening when i have
> validation errors 
> returning to the page. The error message is showing
> up exactly how I 
> want it, except for the fact that is surrounded by
> "null" ex:
> 
> Password: |_____________|  null<--Password Required
> null
>                       |                                               |
>          
>                       |
>                       V                                             
> V                             V
>                  this is a html:text            this is 
> html:errors              bad null
> 
> I have tested my code by putting my logon code into
> the struts-example 
> logon code where everything works out with no "null"
> 's on the page when 
> there are validation errors. I have followed
> previous direction of the 
> posters who so kindly answered my last plea for
> help. This one has me 
> spinning.
> 
> Here is my previous post. Many thanks for all help!
> 
> 
> Hello --
> 
> I'm having a problem  with errors being surrounded
> by "null" on my page
> after validation. Here is a snippet of the html when
> i view source of
> the page through the browser.
> 
>     <tr>
>       <th align="right">
>         User Name:
>       </th>
>       <td align="left">
>         <input type="text" name="username"
> maxlength="16" size="16"
> value="">
>         null
>          <td bgcolor="gray"><font color="red"
> size=2><--Required
> Field</font></td>
>          null
> 
>       </td>
>     </tr>
> 
> Here is what I have in my jsp.
> 
>     <tr>
>       <th align="right">
>         <bean:message key="prompt.username"/>
>       </th>
>       <td align="left">
>         <html:text property="username" size="16"
> maxlength="16"/>
>         <html:errors property="username"/>
>       </td>
>     </tr>
> 
> and my form.
> 
>       public ActionErrors validate(ActionMapping
> mapping,
>                                   
> HttpServletRequest request) {
> 
>           ActionErrors errors = new ActionErrors();
>           if ((username == null) ||
> (username.length() < 1))
>               errors.add("username", new
> ActionError("error.username.required"));
> 
>           return errors;
> 
>       }
> 
> Has anyone ever seen this before. I have checked
> everywhere and have
> found no good answers.
> 
> Thanks.
> 
>  

http://messenger.yahoo.com.au - Yahoo! Messenger
- A great way to communicate long-distance for FREE!

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

Reply via email to