Hi,
I think the problem is that your <html:select...> and <html:options...> tags both
reference the "folders" property. Judging by your code, the <html:options...> tag is
doing what you expect i.e. getting the list of folders the user can select from.
However, your <html:select...> tag is telling Struts to try to assign the selected
folder back to the form bean by calling setFolders (albeit indirectly via
BeanUtils.populate), but setFolders is expecting an ArrayList rather than a single
item from a list which your submit is sending back as a String.
I suspect what you need to do is introduce an additional property called e.g.
selectedFolder into your form bean. Your jsp would then look like this:
<html:select property="selectedFolder" multiple="true">
<html:options property="folders"/>
</html:select>
...and you will need corresponding setter and getter methods in the bean. You can then
also have getSelectedFolder() return a default value.
Regards,
Thorsten
> Hi,
> I'm looking for any hint or advice. I've got code like this
> on my jsp
> page:
>
> <html:select property="folders" multiple="true">
> <html:options property="folders"/>
> </html:select>
>
> property "folders" is a property of my "ModulePathForm" bean:
>
> /* ModulePathForm.java */
> public class ModulePathForm extends ActionForm{
>
> private ArrayList folders;
>
> public ModulePathForm() {
> super();
> folders = new ArrayList();
> }
>
> public ArrayList getFolders() {
> return this.folders;
> }
>
> public void setFolders(ArrayList folders) {
> this.folders = folders;
> }
> }
>
> the values from the bean are shown, but when I click Submit,
> I get this
> exception:
>
> javax.servlet.ServletException: BeanUtils.populate
> at
> org.apache.struts.util.RequestUtils.populate(RequestUtils.java:774)
> at
> org.apache.struts.action.ActionServlet.processPopulate(ActionS
> ervlet.java:2061)
> at
> org.apache.struts.action.ActionServlet.process(ActionServlet.j
> ava:1563)
> at
> org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:509)
>
> .....
> root cause:
>
> java.lang.IllegalArgumentException: argument type mismatch
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>