title: java.lang.IllegalStateException: No primary constructor found for java.util.List
body: <blockquote>
    <p>My project based on spring boot,Thymeleaf,mysql,html and Jquery.</p>
  </blockquote>
  
  <p>I tried to post a <strong>List of EntSetCharges</strong> type data to the @controller ,but it is not succeed..it trows error like </p>
  
  <blockquote>
    <p>java.lang.IllegalStateException: No primary constructor found for
    java.util.List</p>
  </blockquote>
  
  <p>Previously i worked with this error <a href="https://stackoverflow.com/questions/47406346/org-springframework-expression-spel-spelevaluationexception-el1007e-property-o">org.springframework.expression.spel.SpelEvaluationException: EL1007E: Property or field &#39;chargesName&#39; cannot be found on null</a> </p>
  
  <p>Now i got another error in same page </p>
  
  <p><strong>Here is my full code...</strong></p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;!DOCTYPE html&gt;
  &lt;html xmlns:th="http://www.thymeleaf.org"&gt;
  &lt;head&gt;
  &lt;meta charset="ISO-8859-1"&gt;
  &lt;title&gt;Insert title here&lt;/title&gt;
   &lt;!-- bootstrap css lib --&gt; 
        &lt;link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"&gt;
  &lt;/head&gt;
  &lt;body&gt;
   &lt;!-- Bootstrap/Jquery CDN library files --&gt;
   &lt;script src="https://code.jquery.com/jquery-3.2.1.js"&gt;&lt;/script&gt;
   &lt;script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"&gt;&lt;/script&gt;
   &lt;!-- External JQuery Script --&gt;
   &lt;!-- &lt;script type="text/javascript" src="../js/formjs/setchargesform.js"&gt;&lt;/script&gt; --&gt;
   
  &lt;!-- Body Content Goes Here --&gt; 
    &lt;div class="container"&gt;
   &lt;form method="post" th:object="${tempEntSetChargesList}" th:action="@{/updatesetcharges}"&gt;
   &lt;div class="table-responsive"&gt; 
   
   &lt;table class="table table-hover"&gt;
   &lt;thead&gt;
       &lt;tr&gt;
        &lt;th&gt;Charge Name&lt;/th&gt;
        &lt;th&gt;Amount&lt;/th&gt;
        &lt;th&gt;Charge/Unit Type&lt;/th&gt;
      &lt;/tr&gt;
      &lt;/thead&gt;
      
      &lt;tbody&gt;
      &lt;tr th:each="savedcharges:${savedchargeslist}"&gt;
        &lt;td id="colhide" hidden="true"&gt;
        &lt;label th:value="${savedcharges.pkSetCharges}" th:field="*{pkSetCharges}"&gt;&lt;/label&gt;
        &lt;/td&gt;
        
        &lt;td&gt;
        &lt;label th:text="${savedcharges.chargesName}" th:value="${savedcharges.chargesName}" th:field="*{chargesName}"&gt;&lt;/label&gt;
        &lt;/td&gt;
        
        &lt;td&gt;
        &lt;input id="amt1" class="form-control" th:field="*{tempUnitAmount}"&gt;
        &lt;/td&gt;
        
        &lt;td&gt;
    &lt;select id="societyname" class="form-control" th:field="*{tempunitType}"&gt;
    &lt;option value="perFlat" selected="selected"&gt;perFlat&lt;/option&gt;
    &lt;option value="perUnit"&gt;perUnit&lt;/option&gt;
    &lt;option value="perSqrft"&gt;perSqrft&lt;/option&gt;
    &lt;/select&gt;
        &lt;/td&gt;
      &lt;/tr&gt;
      &lt;/tbody&gt;
      
   &lt;/table&gt;
   &lt;/div&gt;
   
   &lt;button type="submit" class="btn btn-info"&gt;Submit&lt;/button&gt;
   &lt;button type="reset" class="btn btn-warn"&gt;Reset&lt;/button&gt;
   &lt;/form&gt;
   &lt;/div&gt;
   &lt;!-- Body content finishes --&gt;
  &lt;/body&gt;
  &lt;/html&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p><strong>@RestController</strong></p>
  
  <pre><code>@PostMapping(value="/updatesetcharges")
      public ModelAndView doUpdateSetCharges(@ModelAttribute List&lt;EntSetCharges&gt; tempEntSetChargesList)
      {
          ModelAndView respondResult = new ModelAndView();
          try {
              List&lt;EntSetCharges&gt; entSetChargesList = new ArrayList&lt;&gt;();
              for(EntSetCharges ent : tempEntSetChargesList)
              {
                  if(ent.getTempunitType().equals("perFlat"))
                  {
                      ent.setPerFlat(Integer.parseInt(ent.getTempUnitAmount()));
                  }
                  else if(ent.getTempunitType().equals("perUnit"))
                  {
                      ent.setPerUnit(Double.parseDouble(ent.getTempUnitAmount()));
                  }
                  else 
                  {
                      ent.setPerSqrft(Double.parseDouble(ent.getTempUnitAmount()));
                  }
                  entSetChargesList.add(ent);
              }
  
              Boolean result = serSetCharges.doUpdateSetCharges(entSetChargesList);
  
          } catch (Exception e) {
              // TODO: handle exception
              e.printStackTrace();
          }
          return respondResult;
      }
  </code></pre>
  
  <p><strong>Entity</strong></p>
  
  <pre><code>@Entity
  @Table(name="setcharges")
  public class EntSetCharges implements Serializable
  {
  
  /**
   * 
   */
  private static final long serialVersionUID = 3827507518731160293L;
  @Id
  @GeneratedValue(strategy=GenerationType.IDENTITY)
  @Column(name="pksetcharges")
  private int pkSetCharges;
  
  @Column(nullable=false)
  private String chargesName;
  @ColumnDefault("0")
  private int perFlat;
  @ColumnDefault("0")
  private double perUnit;
  @ColumnDefault("0")
  private double perSqrft;
  
  @Version
  private int version;
  private Boolean is_active;
  private String created_by;
  private Date created_ts;
  private String modified_by;
  private Date modified_ts;
  private String approved_by;
  private Date approved_ts;
  
  @Transient
  private String tempunitType;
  
  @Transient
  private String tempUnitAmount;
  
  @Transient
  private LogEntSetCharges tempLogEntSetCharges;
  </code></pre>
  
  <p><strong><em>Code UPDATE V1</em></strong>
  Here i made some changes it is hitting the Controller page,but there object is EMPTY [] ..Here is Proof of Image <a href="https://i.stack.imgur.com/3bRZn.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/3bRZn.jpg" alt="Here is the Error Proof v1"></a>
  @RestController</p>
  
  <pre><code>@PostMapping(value="/updatesetcharges")
      public ModelAndView doUpdateSetCharges(@ModelAttribute WrpSetCharges tempEntSetChargesList)
      {
          ModelAndView respondResult = new ModelAndView();
          try {
              List&lt;EntSetCharges&gt; entSetChargesList = new ArrayList&lt;&gt;();
  
              for(EntSetCharges ent : tempEntSetChargesList.getTempEntSetChargesList())
              {   //logics goes here
  </code></pre>
  
  <p><strong>in HTML</strong></p>
  
  <pre><code>&lt;form id="setchargesformid" method="post" th:object="${tempEntSetChargesList}" th:action="@{/updatesetcharges}"&gt;
  </code></pre>
  
  <p><strong>Wrapper class</strong></p>
  
  <pre><code>public class WrpSetCharges {
  
  private List&lt;EntSetCharges&gt; tempEntSetChargesList = new ArrayList&lt;&gt;();
  
  public List&lt;EntSetCharges&gt; getTempEntSetChargesList() {
      return tempEntSetChargesList;
  }
  
  public void setTempEntSetChargesList(List&lt;EntSetCharges&gt; tempEntSetChargesList) {
      this.tempEntSetChargesList = tempEntSetChargesList;
  }
  
  }
  </code></pre>