title: Cannot print correctly at the same time an ArrayList and a form in HTML using Spring MVC
body: <p>I am facing problem trying print at the same time a form and array in the same HTML. </p>
  
  <p>Here is my usuario class:</p>
  
  <pre><code>
  public class usuario {
  
      private String user_id;
      private String createdAt;
      private String address;
      private String latitude;
      private String longitude;
      private String birthday;
      private String email;
      private String user_idp;
      private ArrayList pedido;
      private String phoneNunmber;
      private Integer edad;
      public String nombre;
      private String confirmationCode;
      private String promotions;
  
      public String ciudad;
  
      public String getCiudad() {
          return ciudad;
      }
  
      public void setCiudad(String ciudad) {
          this.ciudad = ciudad;
      }
  
      public String getPromotions() {
          return promotions;
      }
  
      public void setPromotions(String promotions) {
          this.promotions = promotions;
      }
  
      public String getConfirmationCode() {
          return confirmationCode;
      }
  
      public void setConfirmationCode(String confirmationCode) {
          this.confirmationCode = confirmationCode;
      }
  
      public String getNombre() {
          return nombre;
      }
  
      public void setNombre(String nombre) {
          this.nombre = nombre;
      }
  
      public Integer getEdad() {
          return edad;
      }
  
      public void setEdad(Integer edad) {
          this.edad = edad;
      }
  
      public String getPhoneNunmber() {
          return phoneNunmber;
      }
  
      public void setPhoneNunmber(String phoneNunmber) {
          this.phoneNunmber = phoneNunmber;
      }
  
      public String getUser_idp() {
          return user_idp;
      }
  
      public void setUser_idp(String user_idp) {
          this.user_idp = user_idp;
      }
  
      public ArrayList getPedido() {
          return pedido;
      }
  
      public void setPedido(ArrayList pedido) {
          this.pedido = pedido;
      }
  
      public String getEmail() {
          return email;
      }
  
      public void setEmail(String email) {
          this.email = email;
      }
  
      public String getBirthday() {
          return birthday;
      }
  
      public void setBirthday(String birthday) {
          this.birthday = birthday;
      }
  
      public String getUser_id() {
          return user_id;
      }
  
      public void setUser_id(String user_id) {
          this.user_id = user_id;
      }
  
      public String getCreatedAt() {
          return createdAt;
      }
  
      public void setCreatedAt(String createdAt) {
          this.createdAt = createdAt;
      }
  
      public String getAddress() {
          return address;
      }
  
      public void setAddress(String address) {
          this.address = address;
      }
  
      public String getLatitude() {
          return latitude;
      }
  
      public void setLatitude(String latitude) {
          this.latitude = latitude;
      }
  
      public String getLongitude() {
          return longitude;
      }
  
      public void setLongitude(String longitude) {
          this.longitude = longitude;
      }
  
  
  
  }
  
  </code></pre>
  
  <p>Here is my Controller code:</p>
  
  <pre><code>@Controller
  public class GreetingController {
  
  
      @GetMapping("/allusers")
      public String greetingForm(Model model) throws ParseException{
          tablausuario tu = new tablausuario();
          ArrayList&lt;usuario&gt; user = tu.listausuarios();
          Collections.sort(user, (o1, o2) -&gt; o2.getCreatedAt().compareTo(o1.getCreatedAt())); //tabla ordenada
          model.addAttribute("TodosLosUsuarios", user);        
          return "greeting";
      }
  
      @PostMapping("/allusers")
      public String greetingSubmit(Model model, HttpServletRequest request, @ModelAttribute usuario users) {
          String ciudad = request.getParameter("ciudad");
          tablausuariofilterbycity tufc = new tablausuariofilterbycity();
          ArrayList&lt;usuario&gt; userbycity = tufc.listausuariosfiltradosporciudad(ciudad);
          model.addAttribute("TodosLosUsuarios", userbycity);
          return "result";
      }
  
  }
  
  
  </code></pre>
  
  <p>And here is my HTML "greeting"</p>
  
  <pre><code>
  
          &lt;div class="container"&gt;
              &lt;h2&gt;Listado de usuarios &lt;/h2&gt; 
              &lt;p th:text=" ${TodosLosUsuarios.size()} "&gt;&lt;/p&gt;    
              &lt;div id="capa"&gt; &lt;/div&gt; 
              &lt;h1&gt;Form&lt;/h1&gt;
              &lt;form action="#" th:action="@{/allusers}" th:object="${TodosLosUsuarios}" method="post"&gt;
                  &lt;p&gt;Message: &lt;input type="text" th:field="*{ciudad}" /&gt;&lt;/p&gt;
                  &lt;p&gt;&lt;input type="submit" value="Submit" /&gt; &lt;input type="reset" value="Reset" /&gt;&lt;/p&gt;
              &lt;/form&gt;
  
              &lt;input type="text" id="myInput" onkeyup="myFunction()" placeholder="Buscar por ciudad.."&gt;
              &lt;table id="myTable" class="table table-bordered"&gt;
                  &lt;thead&gt;
                      &lt;tr&gt;
                          &lt;th&gt;Nombre&lt;/th&gt;
                          &lt;th&gt;Email&lt;/th&gt;
                          &lt;th&gt;Teléfono&lt;/th&gt;
                          &lt;th&gt;Día creado&lt;/th&gt;
                          &lt;th&gt;Edad&lt;/th&gt;
                          &lt;th&gt;Confirmado&lt;/th&gt;
                          &lt;th&gt;Promocion&lt;/th&gt;
                          &lt;th&gt;Direccion&lt;/th&gt;
  
                      &lt;/tr&gt;
                  &lt;/thead&gt;
                  &lt;tbody  th:each="usuariosTotales: ${TodosLosUsuarios}" &gt;
                      &lt;tr&gt;
                          &lt;td th:text=" ${usuariosTotales.getNombre()} " &gt;&lt;/td&gt;
                          &lt;td th:text=" ${usuariosTotales.getEmail()} " &gt;&lt;/td&gt;
                          &lt;td th:text=" ${usuariosTotales.getPhoneNunmber()} " &gt;&lt;/td&gt;
                          &lt;td th:text=" ${usuariosTotales.getCreatedAt()} " &gt;&lt;/td&gt;
                          &lt;td th:text=" ${usuariosTotales.getEdad()} " &gt;&lt;/td&gt;
                          &lt;td th:text=" ${usuariosTotales.getConfirmationCode()} " &gt;&lt;/td&gt;
                          &lt;td th:text=" ${usuariosTotales.getPromotions()} " &gt;&lt;/td&gt;
                          &lt;td th:text=" ${usuariosTotales.getAddress()} " &gt;&lt;/td&gt;
  
                      &lt;/tr&gt;
  
                  &lt;/tbody&gt;
              &lt;/table&gt;
          &lt;/div&gt;
  
  
      &lt;/div&gt;
  
  </code></pre>
  
  <p>I am sure that the problem is in the form: </p>
  
  <pre><code>
      &lt;form action="#" th:action="@{/allusers}" th:object="${TodosLosUsuarios}" method="post"&gt;
          &lt;p&gt;Message: &lt;input type="text" th:field="*{ciudad}" /&gt;&lt;/p&gt;
          &lt;p&gt;&lt;input type="submit" value="Submit" /&gt; &lt;input type="reset" value="Reset" /&gt;&lt;/p&gt;
      &lt;/form&gt;
  
  </code></pre>
  
  <p>If instead of "user" I use "new usuario"</p>
  
  <pre><code>
          model.addAttribute("TodosLosUsuarios", user);        
  </code></pre>
  
  <p>I use </p>
  
  <pre><code>
          model.addAttribute("TodosLosUsuarios", new usuario());        
  </code></pre>
  
  <p>the form works but I am not able to read the ArrayList, and I get this error:</p>
  
  <pre><code>
  Caused by: org.attoparser.ParseException: Error during execution of processor 'org.thymeleaf.spring5.processor.SpringInputGeneralFieldTagProcessor' (template: "greeting" - line 10, col 40)
      at org.attoparser.MarkupParser.parseDocument(MarkupParser.java:393)
      at org.attoparser.MarkupParser.parse(MarkupParser.java:257)
      at org.thymeleaf.templateparser.markup.AbstractMarkupTemplateParser.parse(AbstractMarkupTemplateParser.java:230)
      ... 48 more
  Caused by: org.thymeleaf.exceptions.TemplateProcessingException: Error during execution of processor 'org.thymeleaf.spring5.processor.SpringInputGeneralFieldTagProcessor' (template: "greeting" - line 10, col 40)
      at org.thymeleaf.processor.element.AbstractAttributeTagProcessor.doProcess(AbstractAttributeTagProcessor.java:117)
      at org.thymeleaf.processor.element.AbstractElementTagProcessor.process(AbstractElementTagProcessor.java:95)
      at org.thymeleaf.util.ProcessorConfigurationUtils$ElementTagProcessorWrapper.process(ProcessorConfigurationUtils.java:633)
      at org.thymeleaf.engine.ProcessorTemplateHandler.handleStandaloneElement(ProcessorTemplateHandler.java:918)
      at org.thymeleaf.engine.TemplateHandlerAdapterMarkupHandler.handleStandaloneElementEnd(TemplateHandlerAdapterMarkupHandler.java:260)
      at org.thymeleaf.templateparser.markup.InlinedOutputExpressionMarkupHandler$InlineMarkupAdapterPreProcessorHandler.handleStandaloneElementEnd(InlinedOutputExpressionMarkupHandler.java:256)
      at org.thymeleaf.standard.inline.OutputExpressionInlinePreProcessorHandler.handleStandaloneElementEnd(OutputExpressionInlinePreProcessorHandler.java:169)
      at org.thymeleaf.templateparser.markup.InlinedOutputExpressionMarkupHandler.handleStandaloneElementEnd(InlinedOutputExpressionMarkupHandler.java:104)
      at org.attoparser.HtmlElement.handleStandaloneElementEnd(HtmlElement.java:79)
      at org.attoparser.HtmlMarkupHandler.handleStandaloneElementEnd(HtmlMarkupHandler.java:241)
      at org.attoparser.MarkupEventProcessorHandler.handleStandaloneElementEnd(MarkupEventProcessorHandler.java:327)
      at org.attoparser.ParsingElementMarkupUtil.parseStandaloneElement(ParsingElementMarkupUtil.java:96)
      at org.attoparser.MarkupParser.parseBuffer(MarkupParser.java:706)
      at org.attoparser.MarkupParser.parseDocument(MarkupParser.java:301)
      ... 50 more
  Caused by: org.springframework.beans.NotReadablePropertyException: Invalid property 'ciudad' of bean class [java.util.ArrayList]: Bean property 'ciudad' is not readable or has an invalid getter method: Does the return type of the getter match the parameter type of the setter?
      at org.springframework.beans.AbstractNestablePropertyAccessor.getPropertyValue(AbstractNestablePropertyAccessor.java:622)
      at org.springframework.beans.AbstractNestablePropertyAccessor.getPropertyValue(AbstractNestablePropertyAccessor.java:612)
      at org.springframework.web.servlet.support.BindStatus.&lt;init&gt;(BindStatus.java:158)
      at org.springframework.web.servlet.support.RequestContext.getBindStatus(RequestContext.java:903)
      at org.thymeleaf.spring5.context.webmvc.SpringWebMvcThymeleafRequestContext.getBindStatus(SpringWebMvcThymeleafRequestContext.java:227)
      at org.thymeleaf.spring5.util.FieldUtils.getBindStatusFromParsedExpression(FieldUtils.java:306)
      at org.thymeleaf.spring5.util.FieldUtils.getBindStatus(FieldUtils.java:253)
      at org.thymeleaf.spring5.util.FieldUtils.getBindStatus(FieldUtils.java:227)
      at org.thymeleaf.spring5.processor.AbstractSpringFieldTagProcessor.doProcess(AbstractSpringFieldTagProcessor.java:174)
      at org.thymeleaf.processor.element.AbstractAttributeTagProcessor.doProcess(AbstractAttributeTagProcessor.java:74)
      ... 63 more
  
  </code></pre>