user2182326
user2182326

Reputation: 77

checkbox - list elements

my checkbox is not showing the values of my list as "checkable" things. Its just saying "publication.keywords" :( But my list is not empty, as I can show it in an iterator.

Please help me. Whats my mistake?

This is my Checkbox

<s:checkbox key="publication.keyword" list="keywords.{name}" /> 

Its working with the Iterator

<s:iterator value="keywords">
<tr>
<td><s:property value="name" /><br></td>
</tr>
</s:iterator>

Upvotes: 0

Views: 90

Answers (1)

coding_idiot
coding_idiot

Reputation: 13734

The syntax is wrong.

Looking at your iterator, the checkboxlist should be like :

<s:checkboxlist list="keywords"  listValue="name" listKey="name"/>

The 'listKey' attribute specifies what will be submitted, if that checkbox is checked. I have used name for now, you can change it to what you require at the backend.

For e.g. if

List<MyBean> keywords

and

class MyBean
{
String name;
Integer id;
//getters and setters
}

then, the s:checkbox can be something like :

<s:checkboxlist list="keywords"  listValue="name" listKey="id"/>

Upvotes: 1

Related Questions