You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by blaas <bl...@itc.it> on 2001/12/19 16:12:59 UTC
problem with bean:checkbox
Hi all,
I have a big problem with the bean:checkbox tag.
My form class (selectedForm) has two fields, one is a TravelPlan and the
other
is a Vector of TraveAsset. Both, TravelPlan & TraveAsset extend the
ActionForm
class as selectedForm do.
In TraveAsset I have a boolean field (selected) to manage from the jsp the
selection
of this asset.
In TravelPlan I have many boolen fields to manage the category of TP
(family, cultural,
adventure ........)
The problem is when I use the selected form in my jsp, as I can't manage the
uncheck
of a category in the TravelPlan otherwise the unchecking of the selected
field in the list
of TravelAsset gets always caught by the action class.
my jsp is:
<form:form action="/jsp/selected.do">
<table cellspacing="3" cellpadding="3" width="100%">
<tr>
<td >
<table cellspacing="0" cellpadding="0" width="100%" align="center">
<tr>
<td width="50%" class="leftDrop">Categories:</td>
<td></td>
</tr>
<tr>
<td ><form:checkbox property='travelPlan.family'
styleClass="leftDrop3"/>family</td>
<td ><form:checkbox property='travelPlan.relax'
styleClass="leftDrop3"/>relax</td>
</tr>
<tr>
<td><form:checkbox property='travelPlan.adventure'
styleClass="leftDrop3"/>adventure</td>
<td><form:checkbox property='travelPlan.culture'
styleClass="leftDrop3"/>culture</td>
</tr>
<tr>
<td><form:checkbox property='travelPlan.summerSport'
styleClass="leftDrop3"/>summer</td>
<td><form:checkbox property='travelPlan.winterSport'
styleClass="leftDrop3"/>winter</td>
</tr>
</table>
</td>
</tr>
<tr>
<td>
<table cellspacing="0" cellpadding="0" width="100%" align="center">
<logic:iterate id="element" name="selectedForm" property="elements"
type="TourismObjects.TourismInterface.TravelAsset">
<tr>
<td class="resultCaption">
Asset Name:<bean:write name="selectedForm" property='<%=
"element["+index+"].name" %>'/>
</td>
<td align="center">
Selected<form:checkbox property='<%=
"element["+index+"].selected"%>'/>
</td>
</tr>
<%index ++;%>
</logic:iterate>
</table>
</td>
</tr>
</table>
<table cellspacing="0" cellpadding="0" width="100%" align="center">
<tr>
<td align="center"> <form:submit property="action" value='Save
this Travel' styleClass="button"/>
</td>
<td align="center"> <form:submit property="action" value='Remove
selected Assets' styleClass="button"/>
</tr>
</table>
</form:form>
could someone help me?
Tanks
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>