You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by Abbas Adel <bi...@tantawi.net> on 2006/10/25 03:13:06 UTC

Bean with a Collection Set

Dears,
I have a "User" bean with java.util.Set property.
I create a struts form with a list to select multiple values from and then
store them in the set. 
I am getting this exception:
java.lang.IllegalArgumentException: Cannot invoke
com.myapp.struts.User.setValues - argument type mismatch

---
public class User extends org.apache.struts.action.ActionForm {
    
    private String name;
    private Set values;

    public String getName() {
        return name;
    }

    public void setName( String name) {
        this.name = name;
    }

    public Set getValues() {
        return values;
    }

    public void setValues(Set values) {
        this.values = values;
    } 
}
----

<html:form action="/post">
    <html:text property="name"/>
    
    <html:select property="values" multiple="true">
        <html:option value="1"/>
        <html:option value="2"/>
        <html:option value="3"/>
        <html:option value="4"/>
        <html:option value="5"/>
        
      <html:submit />
    </html:select>
</html:form>


------

Thanks in advance

BISO


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org