Mar 12th, 2010, 03:21 AM
Write Custom Converter for Multiple Select
Hi, I'm having problems understanding how to write a custom converter which converts the result of a <form:select multiple="multiple"> element back to a List of objects.
I have several other converters for normal select boxes which work perfectly. I just use StringToObject converter. But the multiple box is different because it can return multiple values obviously. The problem I see is that when you select only one item, the result is a String. When you select multiple items the result is an Array. How can you write a Converter for this? You can't specify the source. The Converter I tried to make was only triggered when I selected one item. When I selected more then one the error Webflow gave me was typeMismatch, String expected, even when I specified the source object as ArrayList in the Converter.
Long story short, I have no idea how to proceed and I can't find examples on how to tackle this problem. Which seems strange because this seems like such a common thing. I can't be the only one who wants to use a multi select box for a List of objects in Webflow. Guess I'm just the only one not getting it..
Any help is much appreciated!
Last edited by couchpotato; Mar 12th, 2010 at 08:21 AM.
Jan 30th, 2012, 06:05 PM
Having same problem
Did you find an answer for this? Can you post example code or a URL?
I'm trying to bind a collection of String IDs to a set of populated domain objects in my command class.
Tags for this Thread