title: How to pass a Map<ObjectA, List<ObjectB>> to action in Struts 2
body: <p>I have a event object, inside there is a <code>Map&lt;ObjectA, List&lt;ObjectB&gt;&gt;</code>, the <code>ObjectA</code> is the label, and the <code>list&lt;ObjectB&gt;</code> are table rows. With following code, I can display the tables correctly, but when I submit the form to <code>Action</code> class, the map is <code>null</code> inside the event.</p>
  <p><strong>JSP CODE:</strong></p>
  <pre class="lang-jsp prettyprint-override"><code>&lt;s:iterator value=&quot;event.planMap&quot; var=&quot;map&quot; &gt;
      &lt;h4&gt;Plan Type: &lt;s:property value='key' /&gt;&lt;/h4&gt;
      &lt;table id=&quot;plan&quot;&gt;
      &lt;s:iterator value=&quot;value&quot; status=&quot;stat&quot; var=&quot;detail&quot; &gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;input type=&quot;text&quot; id=&quot;name&quot; name=&quot;event.planMap['%{#map.key}'][%{#stat.index}].name&quot; value=&quot;&lt;s:property value='name'/&gt;&quot;/&gt;&lt;/td&gt;
              &lt;td&gt;&lt;input type=&quot;text&quot; id=&quot;text&quot; name=&quot;event.planMap['%{#map.key}'][%{#stat.index}].text&quot; value=&quot;&lt;s:property value='text'/&gt;&quot;/&gt;&lt;/td&gt;
              &lt;td&gt;&lt;input type=&quot;text&quot; id=&quot;contact&quot; name=&quot;event.planMap['%{#map.key}'][%{#stat.index}].contact&quot; value=&quot;&lt;s:property value='contact'/&gt;&quot;/&gt;&lt;/td&gt;
          &lt;/tr&gt;
          &lt;/s:iterator&gt;
      &lt;/table&gt;
  &lt;/s:iterator&gt;
  </code></pre>
  <p>@Andrea &amp; Roman, So I modified the code. displaying the table is correct, but I got error  and it went to Result input. If I remove the <code>planMap</code>, the action goes to success. So at least I know the error are the <code>planMap</code>.  The modified code is:</p>
  <p><strong>The <code>Event</code> definition:</strong></p>
  <pre><code>public Event {
      private Map&lt;Object_A, Object_B&gt; planMap;
      public Map&lt;Object_A, Object_B&gt; getPlanMap {
             return this.planMap;
      }
  
      public void setPlanMap(Map&lt;Object_A, Object_B&gt; planMap) {
             this.planMap = planMap;
      }
  }
  </code></pre>
  <p><strong>The <code>Object_B</code> definition:</strong></p>
  <pre><code>public Object_B {
      private List&lt;Object_C&gt; details;
      
      public List&lt;Object_C&gt; getDetials() {
             return this.details;
      }
      public void setDetails(List&lt;Object_C&gt; details) {
             this.details = details;
      }
  }
  </code></pre>
  <p><strong>The JSP code is:</strong></p>
  <pre><code>&lt;s:iterator value=&quot;event.planMap&quot; status=&quot;mStat&quot;  &gt;
      &lt;h4&gt;Plan Type: &lt;s:property value='key' /&gt;&lt;/h4&gt;
      &lt;table id=&quot;plan&quot;&gt;
      &lt;s:iterator value=&quot;value.details&quot; status=&quot;stat&quot;&gt;
      &lt;tr&gt;
          &lt;td&gt;&lt;input type=&quot;text&quot; id=&quot;name&quot; name=&quot;event.planMap['% {#mStat.index}'].details[%{#stat.index}].name&quot; value=&quot;&lt;s:property value='name'/&gt;&quot;/&gt;&lt;/td&gt;
          &lt;td&gt;&lt;input type=&quot;text&quot; id=&quot;text&quot; name=&quot;event.planMap['%{#mStat.index}'].details[%{#stat.index}].text&quot; value=&quot;&lt;s:property value='text'/&gt;&quot;/&gt;&lt;/td&gt;
          &lt;td&gt;&lt;input type=&quot;text&quot; id=&quot;contact&quot; name=&quot;event.planMap['%{#mStat.index}'].details[%{#stat.index}].contact&quot; value=&quot;&lt;s:property value='contact'/&gt;&quot;/&gt;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;/s:iterator&gt;
  &lt;/table&gt;
  &lt;/s:iterator&gt;
        
  </code></pre>