title: How to display html:text using <logic:iterate> for List<String> in Struts1.1
body: <p>I have a <code>List&lt;String&gt;</code> in my <code>ActionForm</code> which has to be represented as a text field in the JSP page using <code>Struts1.1</code></p>
  
  <pre><code> List&lt;String&gt; url=new ArrayList&lt;String&gt;();
   public List&lt;String&gt; getUrl() {
          return url;
      }
      public void setUrl(List&lt;String&gt; url) {
          this.url = url;
      }
  </code></pre>
  
  <p>The Following is the code that I have used inside JSP page</p>
  
  <pre><code> &lt;logic:iterate id="urlIterate" name="pForm" property="url"&gt;
      &lt;html:text property="?????" name="urlIterate"/&gt;
      &lt;/logic:iterate&gt;
  </code></pre>
  
  <p><code>&lt;html:text&gt;</code> is working good for <code>List&lt;SomeClass&gt;</code> because property can be point to a particular variable and <code>List&lt;SomeClass&gt;</code> acts as a bean.</p>
  
  <pre><code> &lt;logic:iterate id="listUserId" property="listUsers" name="pForm"&gt;
   &lt;html:text name="listUserId" property="username"/&gt;
   &lt;/logic:iterate&gt;
  </code></pre>
  
  <p>where listUsers is a <code>List</code> with <code>User</code> type of class 
  private List listUsers;
   In <code>property="username"</code> <code>username</code> is a variable inside <code>User</code> Class</p>
  
  <p>For <code>List&lt;String&gt;</code> </p>
  
  <pre><code>&lt;bean:write name="urlIterate" /&gt;
  </code></pre>
  
  <p>I don't find issue  to display as a text using <code>&lt;bean:write&gt;</code> since it has only <code>name</code> attribute.
  But to use <code>&lt;html:text&gt;</code> we need to add another mandatory attribute <code>property</code>.</p>
  
  <p>Can any one please help me out. what value to be used for <code>property='?????'</code> in order to make the <code>html:text</code> to work correctly.</p>
  
  <p>Thanks in advance</p>
  
  <p>Providing more code..
  JSP page for UI.</p>
  
  <pre><code>&lt;%@taglib uri="http://jakarta.apache.org/struts/tags-logic" prefix="logic"%&gt;
  
  &lt;html&gt;
  &lt;head&gt;
  &lt;/head&gt;
  &lt;body&gt;
  &lt;html:form action="/plist"&gt;
  &lt;h1&gt;Struts &amp;lt;logic:iterate&amp;gt; example&lt;/h1&gt;
  
    &lt;logic:iterate property="listMsg" name="pForm"  id="listMsgId"&gt;
      &lt;p&gt;
      List Messages &lt;/p&gt; &lt;html:text property="listMsgId" indexed="true"/&gt; 
  
  &lt;/logic:iterate&gt;
  
   &lt;html:submit/&gt;
  
    &lt;/html:form&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>Action Class:</p>
  
  <pre><code>public class PrintMsgAction extends Action {
  
  
      public ActionForward execute(ActionMapping mapping,ActionForm form,
          HttpServletRequest request,HttpServletResponse response) 
                  throws Exception {
  
          List&lt;OptionsListCollection&gt; listoptions=new ArrayList&lt;OptionsListCollection&gt;();
  
                  for(int i=0;i&lt;10;i++){
                      listoptions.add(new OptionsListCollection("Option"+i, "OptionValue"+i));    
                  }
  
                  List&lt;String&gt; listMsg = new ArrayList&lt;String&gt;();
  
                  listMsg.add("Message A");
                  listMsg.add("Message B");
                  listMsg.add("Message C");
                  listMsg.add("Message D");
  
                              PrintForm pForm=(PrintForm)form;
                  pForm.setListMsg(listMsg);
  
  
  
                  return mapping.findForward("plist");
              }
  }
  </code></pre>
  
  <p>and ActionForm</p>
  
  <pre><code>public class PrintForm extends ActionForm{
  
      private List&lt;String&gt; listMsg;
  
      public List&lt;String&gt; getListMsg() {
          return listMsg;
      }
      public void setListMsg(List&lt;String&gt; listMsg) {
          this.listMsg = new ArrayList&lt;String&gt;();
  
          this.listMsg = listMsg;
  
      }
  }
  </code></pre>