You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@beehive.apache.org by sourmugster <so...@gmail.com> on 2007/11/30 00:36:23 UTC
Formbean list containing selected checkbox values twice
Hi,
I have created a form containing several input fields and a dynamically
generated list of checkboxes.
When I submit the form, all fields are put in the appropriate member
variables in my formbean.
For the checkboxes, a list is being used to contain the selected values.
The problem is, that the list contains all the selected items twice.
For instance.
JSP:
<netui:checkBoxGroup dataSource="actionForm.items" orientation="vertical">
<netui:checkBoxOption value="item1">item1</netui:checkBoxOption>
<netui:checkBoxOption value="item2">item2</netui:checkBoxOption>
<netui:checkBoxOption value="item3">item3</netui:checkBoxOption>
</netui:checkBoxGroup>
FormBean:
public static class MyFormBean implements java.io.Serializable {
private static final long serialVersionUID = 43170698L;
private List items = new ArrayList();
private String lastName = "";
...
public List getItems() {
return items;
}
public void setItems(List items) {
this.items = items;
}
public String getLastName() {
return lastName;
}
public void setLastName(String lastName) {
this.lastName = lastName;
}
...
After selecting item1 and item3, the list looks like this:
item1, item3, item1, item3
Has anyone encountered the same problem and perhaps found a solution for
this...
Thx in advance.
Geert
--
View this message in context: http://www.nabble.com/Formbean-list-containing-selected-checkbox-values-twice-tf4900685.html#a14037551
Sent from the Beehive - User mailing list archive at Nabble.com.
Re: Formbean list containing selected checkbox values twice
Posted by sourmugster <so...@gmail.com>.
sourmugster wrote:
>
> Hi,
>
> I have created a form containing several input fields and a dynamically
> generated list of checkboxes.
>
> When I submit the form, all fields are put in the appropriate member
> variables in my formbean.
> For the checkboxes, a list is being used to contain the selected values.
> The problem is, that the list contains all the selected items twice.
>
I found a solution for my problem...
It seems that a checkboxGroup needs to be bound to a String[] type.
--
View this message in context: http://www.nabble.com/Formbean-list-containing-selected-checkbox-values-twice-tf4900685.html#a14129524
Sent from the Beehive - User mailing list archive at Nabble.com.