mercredi 16 septembre 2015

How to display preselected checkboxes in a struts2 Iterator

I'm displaying a list as checkboxes. In this some checkboxes should be prechecked based on the database values. If I use checkboxlist I can achive this, but I'm able to display only one property(listValue) after checkbox. I need to display more than one property after checkbox.

<s:checkboxlist list="myList" name="checkboxes" listKey="id" listValue="name" value="selectedList"/>

here myList has the available checkboxes and selectedList contain the keys that should be precheked

So how to achive the same functionality with a checkbox in an iterator...? The code that I have tried to display available checkboxes are...

<s:iterator value="myList" var="record">
<s:checkbox name="id" value="%{#record.id}"/>
<s:property value="#record.name"/>
<s:property value="#record.description"/>
</iterator> 




Aucun commentaire:

Enregistrer un commentaire