You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Rajanala, Srinivas" <sr...@qwest.com> on 2003/09/24 01:04:45 UTC

Using Form Bean & Java Bean....

Hi,

Can I use both Form Bean & Java Bean inside a html:form?
I have ManageProfileBean(java bean) which has availRoles and
ManageProfileForm(Form bean) which has securityRoles. I need to iterate
through availRoles and display it as checkbox. When the user selects one or
more check boxes the data should get populated in the securityRoles of the
form bean.
I am trying to use the following code:
<html:form action="/manageProfile"> 


<td class=tr_header>Security Roles</td>
           <logic:present name="availRoles">
		       <logic:iterate name="availRoles" id="roles"
type="com.qwest.omt.bean.ManageProfileBean.availRoles">
		          <td>
                  <html:checkbox name="securityRoles" property="key"/>
                      <bean:write name="roles" property="value"/><br>
                  </logic:iterate>
                  </td>
            </logic:present>


In the following code, I am trying to use availDepts from the
ManageProfileBean(Java Bean) and
department from the ManageProfileForm(Form Bean). 


<logic:present name="availDepts">
                  <logic:iterate name="availDepts" id="dt">
                    <td>
                    <html:select property="department">
                      <html:option value="key">
                         <bean:write name="dt" property="value">
                      </html:option>
                    </html:select>
                  </logic:iterate>   
				  </td>
		   </logic:present>


Is it a correct? I appreciate your suggesions.

Thanks,
Srini

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


Re: Using Form Bean & Java Bean....

Posted by Mick Knutson <mi...@hotmail.com>.
I have a DynaActionForm that has several DTO's in an Array:

        <form-bean  name="locationListForm"
                    dynamic="false"
                    type="org.apache.struts.validator.DynaValidatorForm">
            <form-property name="userLocations"
type="com.baselogic.yoursos.location.LocationDto[]" />
            <form-property name="locationId" type="java.lang.String" />
            <form-property name="cellColor" type="java.lang.String"
initial="content_tbl_white" />
        </form-bean>

Works great.

---
Thanks
Mick Knutson
http://www.baselogic.com

+001(805) 563-0666 Office
+001 (708) 570-2772 Fax
---

----- Original Message ----- 
From: "Rajanala, Srinivas" <sr...@qwest.com>
To: "'Struts Users Mailing List'" <st...@jakarta.apache.org>
Sent: Tuesday, September 23, 2003 4:04 PM
Subject: Using Form Bean & Java Bean....


>
> Hi,
>
> Can I use both Form Bean & Java Bean inside a html:form?
> I have ManageProfileBean(java bean) which has availRoles and
> ManageProfileForm(Form bean) which has securityRoles. I need to iterate
> through availRoles and display it as checkbox. When the user selects one
or
> more check boxes the data should get populated in the securityRoles of the
> form bean.
> I am trying to use the following code:
> <html:form action="/manageProfile">
>
>
> <td class=tr_header>Security Roles</td>
>            <logic:present name="availRoles">
>        <logic:iterate name="availRoles" id="roles"
> type="com.qwest.omt.bean.ManageProfileBean.availRoles">
>           <td>
>                   <html:checkbox name="securityRoles" property="key"/>
>                       <bean:write name="roles" property="value"/><br>
>                   </logic:iterate>
>                   </td>
>             </logic:present>
>
>
> In the following code, I am trying to use availDepts from the
> ManageProfileBean(Java Bean) and
> department from the ManageProfileForm(Form Bean).
>
>
> <logic:present name="availDepts">
>                   <logic:iterate name="availDepts" id="dt">
>                     <td>
>                     <html:select property="department">
>                       <html:option value="key">
>                          <bean:write name="dt" property="value">
>                       </html:option>
>                     </html:select>
>                   </logic:iterate>
>   </td>
>    </logic:present>
>
>
> Is it a correct? I appreciate your suggesions.
>
> Thanks,
> Srini
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>
>

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