title: Struts2 binding a map inside an object to an action attribute
body: <p><strong>Part 1:</strong> 
  There is an object (ObjectA) which has another object (ObjectB). There is a Hashmap inside the Object B. This hashmap has a string as key and another object "ObjectC" as value.  This hashmap has been displayed on the jsp using the s:iterator and s:textfield and it is being displayed correctly. i.e. the "values" inside the s:textfield are correct but the "name" are not.
  Now, the problem arises when the textfield is modified. How do we capture the modified values inside ObjectC in the action class?  </p>
  
  <pre class="lang-java prettyprint-override"><code>public class ObjectA implements Serializable {
      private Integer attr1;
      private List&lt;ObjectB&gt; objB;
      //...getters and setters....
  </code></pre>
  
  <pre class="lang-java prettyprint-override"><code>public class ObjectB implements Serializable {
  private Integer attr11;
  private Map&lt;String,ObjectC&gt; myMap;
      // ...getters and setters....
  </code></pre>
  
  <pre class="lang-java prettyprint-override"><code>public class ObjectC implements Serializable {
  private Integer attr111;
  public String attr112;
      // ...getters and setters....
  </code></pre>
  
  <hr>
  
  <p><strong>jsp code:</strong></p>
  
  <pre><code>&lt;s:iterator value="#objB.myMap" var="fieldMap" status="fieldStatus"&gt;
  
  &lt;li&gt;&lt;label&gt;&lt;s:property value="#fieldMap.key"/&gt;&lt;/label&gt;&lt;span&gt;
  &lt;s:textfield name="&lt;NOT SURE&gt;" value="%{#fieldMap.value.attr12}"  /&gt;&lt;/span&gt;&lt;/li&gt;
  
  
  
  &lt;/s:iterator&gt; 
  </code></pre>