Announcement Announcement Module
Collapse
No announcement yet.
Binding Map with values that contains Lists. Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Binding Map with values that contains Lists.

    I have a HashMap with String keys and List values:

    Code:
    List l1 = new ArrayList();
    List l2 = new ArrayList();
    List l3 = new ArrayList();
    
    l1.add(""); l1.add("");
    l2.add(""); l2.add("");
    l3.add(""); l3.add("");
    
    Map map = new HashMap();
    
    map.put("key1",l1);
    map.put("key2",l2);
    map.put("key3",l3);
    Is there a way to bind text fields to the strings in the list?

    Code:
    <input type="textfield" name="map&#91;key1&#93;&#91;0&#93;" value="value"/>
    <input type="textfield" name="map&#91;key1&#93;&#91;1&#93;" value="value"/>
    
    <input type="textfield" name="map&#91;key2&#93;&#91;0&#93;" value="value"/>
    <input type="textfield" name="map&#91;key2&#93;&#91;1&#93;" value="value"/>
    
    <input type="textfield" name="map&#91;key3&#93;&#91;0&#93;" value="value"/>
    <input type="textfield" name="map&#91;key3&#93;&#91;1&#93;" value="value"/>
    I would imagine that would be the mapping but it does not work. map[key1] works for a hashmap and list[0] works for a list but is there a way to combine? Do I need to write some custom binders to get this to work?

    Thanks,

    Ethan Schreiber

  • #2
    funny how it works

    I was stuck on this for a few hours yesterday. I posted the question this morning and I figured it out as soon as I finished posting:

    I had both the spring-1.1.1 and spring-1.1.4 jars in my lib dir cause I didn't do a clean build. I deleted the spring-1.1.1.jar and it started working! Apparently, this functionality is supported by spring-1.1.4 but not 1.1.1

    Ethan

    Comment

    Working...
    X