Getting multiple select from a dropdownbox of type List
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Espen_Lysvik
Posted On:   Thursday, January 29, 2004 01:08 AM

Hi! I'am populating a dropdown-box and view it in a JSP page like this :    property="codesFmopp" value="reasoncode" /> In my Form the Collection are defined like this: private List codesFmopp; Getters and setters public void setCodesFmopp( List codesFmopp ) { this.codesFmopp = codesFmopp; } public List getCodesFmopp() { return codesFmopp; } When I try to select an item in the list, I get an errormessage even before struts get to the Action: java.lang.IllegalArgumentException: argument ty   More>>

Hi!

I'am populating a dropdown-box and view it in a JSP page like this :



  
property="codesFmopp" value="reasoncode" />





In my Form the Collection are defined like this:

private List codesFmopp;

Getters and setters


public void setCodesFmopp( List codesFmopp )

{

this.codesFmopp = codesFmopp;

}



public List getCodesFmopp()

{

return codesFmopp;

}



When I try to select an item in the list, I get an errormessage even before struts get to the Action:

java.lang.IllegalArgumentException: argument typemismatch.

Anyone have a solution?


Regards Espen Lysvik

   <<Less

Re: Getting multiple select from a dropdownbox of type List

Posted By:   Dan_Nelson  
Posted On:   Monday, February 2, 2004 01:33 PM

Try a string array:



private String[] codesFmopp;

public void setCodesFmopp(String[] codesFmopp)

{

    this.codesFmopp = codesFmopp;

}


public String[] getCodesFmopp()

{

    return this.codesFmopp;

}



This will place the selected option VALUEs into the string array codesFmopp. This is the way I have always done it and have never experienced any problems. I hope this helps.

--Dan

About | Sitemap | Contact