title: Using <s:set /> to dynamically build element's name
body: <p>I want to reuse a set of HTML field elements and have struts build 'name' attributes from a variable. I saw this <a href="https://stackoverflow.com/questions/5091253/how-to-generate-unique-html-id-attributes-within-struts-2-iterator-tag">How To Generate unique HTML id attributes within Struts 2 iterator tag</a> and figured I could use something similar but can't get it to work. It seems I can build a name attribute from a struts variable only in an iterator loop. How can I do this with a simple variable instead?</p>
  
  <p>Here is my code, first trying to use a variable, the second using an iterator :</p>
  
  <pre><code>&lt;s:set var="type" value="Main" /&gt;
  &lt;s:textfield name="prefix%{#type}.Name"/&gt;
  
  &lt;s:set var="AList" value="{'Main'}" /&gt;
  &lt;s:iterator value="AList" var="Ltype"&gt;
      &lt;s:textfield name="prefix%{#Ltype}.Name"/&gt;
  &lt;/s:iterator&gt;
  </code></pre>
  
  <p>This generates 2 elements :</p>
  
  <pre><code>&lt;input type="text" name="prefix.Name"     value=""&gt;
  &lt;input type="text" name="prefixMain.Name" value=""&gt;
  </code></pre>
  
  <p>with the first not substituting the variable, and the iterator loop working.</p>
  
  <p>Why doesn't it work and how can I do this?</p>