title: Handling Form Submission in Gradle for Objects
body: <p>I assume you well versed with Spring and also knowledgeable with <a href="http://spring.io/guides/gs/handling-form-submission/" rel="nofollow noreferrer">this guide</a>.</p>
  
  <p>My goal is to dispatch Java objects like a list, a table or an image and call some function with them as parameters. </p>
  
  <p>However neither the Thymeleaf document nor the Spring Documentation contain such complex cases and thus I am at loss. </p>
  
  <p>I would be helped, if one could provide the neccessary syntax in the Java Greeting class to dispatch an ArrayList, store them first in the html script, calling functions on them with them as parameters. I am not interested in anything fancy, but just the syntax. </p>
  
  <p>Below the simplistic code for a quick reference.   </p>
  
  <p>Jave Code:</p>
  
  <pre><code>package hello;
  
  import org.springframework.stereotype.Controller;
  import org.springframework.ui.Model;
  import org.springframework.web.bind.annotation.ModelAttribute;
  import org.springframework.web.bind.annotation.RequestMapping;
  import org.springframework.web.bind.annotation.RequestMethod;
  import org.springframework.web.bind.annotation.RequestParam;
  
  @Controller
  public class GreetingController {
  
      @RequestMapping(value="/greeting", method=RequestMethod.GET)
      public String greetingForm(Model model) {
          model.addAttribute("greeting", new Greeting());
          return "greeting";
      }
  
      @RequestMapping(value="/greeting", method=RequestMethod.POST)
      public String greetingSubmit(@ModelAttribute Greeting greeting, Model model) {
          model.addAttribute("greeting", greeting);
          return "result";
      }
  
  }
  </code></pre>
  
  <p>HTML Code:</p>
  
  <pre><code>&lt;!DOCTYPE HTML&gt;
  &lt;html xmlns:th="http://www.thymeleaf.org"&gt;
  &lt;/script&gt;
  &lt;head&gt;
      &lt;title&gt;Getting Started: Handling Form Submission&lt;/title&gt;
      &lt;meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /&gt;
  &lt;/head&gt;
  &lt;body&gt;
      &lt;h1&gt;Result&lt;/h1&gt;
      &lt;p th:text="'id: ' + ${greeting.id}" /&gt;
      &lt;p th:text="'content: ' + ${greeting.content}" /&gt;
      &lt;a href="/greeting"&gt;Submit another message&lt;/a&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>To ensure the high quality of Stack Overflow I strongly recommend reading <a href="https://stackoverflow.com/help/how-to-answer">this article here</a> first before commenting or answering. If you have nothing constructive to say, leave. Thanks in advance. </p>