You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by jeniclement <ru...@yahoo.com.sg> on 2007/10/10 04:32:12 UTC
Dynamic Layout Checkbox - how to check automatically
I have created a checkboxes by the following code.
<layout:checkboxes key="flightallocation.location1" property="location"
styleClass="LABEL" >
<layout:options collection="locationsList" property="data1"
labelProperty="data2"/>
</layout:checkboxes>
here "locationsList" is the collection of locations from database.
it generate the HTML :
<input type="checkbox" name="location[0]" value="EK01"> Carousel 01
<input type="checkbox" name="location[1]" value="EK02"> Carousel 02
<input type="checkbox" name="location[2]" value="EK03"> Carousel 03
<input type="checkbox" name="location[3]" value="EK04"> Carousel 04
<input type="checkbox" name="location[4]" value="EK05"> Carousel 05
<input type="checkbox" name="location[5]" value="PROB"> Mis-track line
I'm using DynaValidatorActionForm.
And when submitting the page, i collect the selected locations into
"locationList"
it is a arraylist property in my form bean.
Till this point , it is working fine.
when I want to update a record, For ex. Each record has one or more
locations.
How can i check those locations in the page, when it loads?
In my JSP, I have
"locationsList" - collection. It has all the locations in the database.
"locationList" - ArrayList. Form bean property. Having the locations to be
selected.
For ex.
locationsList - EK01,EK02,EK03,EK04,EK05,EK06
locationLsit - EK01,EK05
--
View this message in context: http://www.nabble.com/Dynamic-Layout-Checkbox---how-to-check-automatically-tf4598212.html#a13128409
Sent from the Struts - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Dynamic Layout Checkbox - how to check automatically
Posted by Laurie Harper <la...@holoweb.net>.
Is layout:checkboxes from the Struts Layout project, or something else?
I would suggest chceking the documentation for the originating taglib,
but my first guess would be that you need property="locationList"
instead of property="location" based on what you describe below.
L.
jeniclement wrote:
> I have created a checkboxes by the following code.
>
> <layout:checkboxes key="flightallocation.location1" property="location"
> styleClass="LABEL" >
> <layout:options collection="locationsList" property="data1"
> labelProperty="data2"/>
> </layout:checkboxes>
>
> here "locationsList" is the collection of locations from database.
>
> it generate the HTML :
> <input type="checkbox" name="location[0]" value="EK01"> Carousel 01
> <input type="checkbox" name="location[1]" value="EK02"> Carousel 02
> <input type="checkbox" name="location[2]" value="EK03"> Carousel 03
> <input type="checkbox" name="location[3]" value="EK04"> Carousel 04
> <input type="checkbox" name="location[4]" value="EK05"> Carousel 05
> <input type="checkbox" name="location[5]" value="PROB"> Mis-track line
>
>
> I'm using DynaValidatorActionForm.
>
> And when submitting the page, i collect the selected locations into
> "locationList"
> it is a arraylist property in my form bean.
>
> Till this point , it is working fine.
>
> when I want to update a record, For ex. Each record has one or more
> locations.
> How can i check those locations in the page, when it loads?
>
> In my JSP, I have
> "locationsList" - collection. It has all the locations in the database.
> "locationList" - ArrayList. Form bean property. Having the locations to be
> selected.
>
> For ex.
> locationsList - EK01,EK02,EK03,EK04,EK05,EK06
> locationLsit - EK01,EK05
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org