Adding values in List<String> dynamically
<p>Every time a new String is generated but the List is having null value for it.</p>

<pre><code>&lt;h:dataTable value="#{add.periods}" var="prd"&gt;
        &lt;h:column&gt;&lt;h:inputText value="#{prd}"  /&gt;&lt;/h:column&gt;
    &lt;/h:dataTable&gt;
    &lt;h:commandButton value="add" action="#{add.addList}" /&gt;
    &lt;h:commandButton value="submit" action="#{add.submit}" /&gt;
&lt;/h:dataTable&gt;    
</code></pre>

<p>Entity AddPeriods: object add</p>

<pre><code>private List&lt;String&gt; periods = new ArrayList&lt;String&gt;();
    @ElementCollection
     public List&lt;String&gt; getPeriods() 
     {         
            return periods;
     }
        public void setPeriods(List&lt;String&gt; periods)      
        {

         this.periods=periods;
         }

         public void addList() 
         { 

          periods.add(new String());

         }
          public void submit()
          {
          System.out.println("periods..................................: " +periods);
           }
</code></pre>

<p>Message on Console:After 2 times addition</p>

<pre>
    periods..................................: [, ]
</pre>
