struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thomas CORNET <tho...@cornet.name>
Subject Re: Struts not parsing HTML correctly?
Date Tue, 04 Mar 2003 09:03:41 GMT
At 09:51 04/03/2003, you wrote:
>There are actually 2 problems I'm experiencing:
>
>Firstly, I have the following snippet in one of my forms (user_add.jsp):
>
>                     <!-- tr>
>                         <th>Contract User</th>
>                         <td>
>                             <html:checkbox property="contractUser"/>
>                         </td>
>                     </tr -->
>
>If this is present, struts fails with the following error:
>
>org.apache.jasper.JasperException: No getter method for property contractUser
>of bean org.apache.struts.taglib.html.BEAN
>
>This happens whether that section is commented out or not, but does not occur
>if I remove the code entirely.

Struts doesn't care of HTML comments, all the JSP source is processed to 
produce HTML content, and that's the navigator which is checking HTML 
comments to display contents or not.


>The second problem is that I actually DO have a getter (and setter) method 
>for
>contractUser in UserForm.java:
>
>     /* Contract User */
>     private boolean contractUser = false;
>     public boolean getContractUser() {
>         return this.contractUser;
>     }
>     public void setContractUser(boolean contractUser) {
>         this.contractUser = contractUser;
>     }
>
>
>I have the following in my struts config:
>
><struts-config>
>     <form-beans>
>...
>         <form-bean name="userForm"
>                    type="com.somewhere.aproject.UserForm" />
>...
>     </form-beans>
>     <action-mappings>
>...
>         <action path="/screen_user_add"
>              forward="/user_add.jsp"
>                 name="userForm"
>             validate="false"/>
>...
>     </action-mappings>
></struts-config>
>
>
>I know the configuration is right since the rest of the fields work fine.
>Should I be using type String instead of boolean for contractUser?

I've read somewhere that all forms fields should be declared as String in 
the Form classes... It is recommended to make the conversions in your 
actions classes.


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


Mime
View raw message