If the request object contains nulls, the response object in JSP returns the
String "null."  Test for the presence of nulls in the request object and
return an empty String ("").

Mark

-----Original Message-----
From: Team Gasoline [mailto:[EMAIL PROTECTED]]
Sent: Friday, April 19, 2002 8:29 PM
To: [EMAIL PROTECTED]
Subject: null in html on validation


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.

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

Reply via email to