title: How to access nested elements in struts2 with foreach tag?
body: <p>I have the following problem in Struts 2.</p>
  
  <p>Let's assume i have a class like this</p>
  
  <pre><code> class User {
         private String name;
         private String address;
         public String getName() { return name;}
         public String getAddress() { return address;}
      }
  </code></pre>
  
  <p>and a list of users available on ValueStack named : <strong>users</strong>
  and a list of user propertiesavailable also on ValueStack as: <strong>userProps</strong>.
  In this case <strong>userProps</strong> would be {name, address}. </p>
  
  <p>Now I want to iterate over the <strong>users</strong> list and dinamycally access one user properties via  <strong>userProps</strong>.</p>
  
  <p>Here is how:</p>
  
  <pre><code> &lt;s:iterator value="#users" var="user"&gt;
      &lt;s:iterator value="#userProps" var="prop"&gt;    
        **&lt;%--- HOW to get user.name, user.address ???%&gt;**
         &lt;s:property value="#user.%{#prop}"/&gt;
      &lt;/s:iterator&gt;
   &lt;/s:iterator&gt;
  </code></pre>
  
  <p>I dont know how to evaluate #user.#data to obtain the value for #user.name or #user.address ??</p>
  
  <p>Thank you.</p>