title: How to fix "Exception evaluating SpringEL expression" error after submitting a variable Spring/Thymeleaf
body: <p>I am using Spring Boot/Thymeleaf to create a form that accepts an email address, redirects to a results page that displays the accepted email and sends it to a third party API (authenticated with Oauth2). I am having trouble with the form portion, I am attempting to use Thymeleaf to accept the input to display it on the result.html page. I am receiving an error when trying to display it on the results page, full error is:  </p>
  
  <pre><code>[THYMELEAF][http-nio-8080-exec-4] Exception processing template "result.html": Exception evaluating SpringEL expression: "signup.email" (template: "result.html" - line 10, col 4)
  </code></pre>
  
  <p>I was attempting to follow the examples provided here: 
  <a href="https://spring.io/guides/gs/handling-form-submission/" rel="nofollow noreferrer">https://spring.io/guides/gs/handling-form-submission/</a></p>
  
  <p>I have attempted to modify the controller from <code>@PostMapping</code> and <code>@GetMapping</code> to <code>@RequestMapping</code> and add commenting described in a workaround such as: </p>
  
  <pre><code>&lt;!--/*@thymesVar id="signup" type="com.mainconfig.controller1"*/--&gt;
  </code></pre>
  
  <p>Here is the <code>signup.html</code> code containing the form: </p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html xmlns:th="http://www.thymeleaf.org"&gt;
  
  &lt;html&gt;
  &lt;head&gt;
      &lt;title&gt;My Jmml&lt;/title&gt;
      &lt;meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /&gt;
  &lt;/head&gt;
  &lt;body style="background-color: #2B2B2B"&gt;
  &lt;br /&gt;&lt;br /&gt;
  &lt;h2 style="text-align:center"&gt;Contact Information&lt;/h2&gt;
  &lt;!-- Input Form --&gt;
  
  &lt;!--/*@thymesVar id="signup" type="com.mainconfig.controller1"*/--&gt;
  &lt;form action="#" th:action="@{/signup}" th:object="${signup}" method="post"&gt;
      &lt;div align="center"&gt;
          &lt;label&gt;Email Address&lt;/label&gt;&lt;br /&gt;&lt;br /&gt;
          &lt;!--/*@thymesVar id="email" type="String"*/--&gt;
          &lt;input type="text" th:field="*{email}" placeholder="Email" required /&gt;
          &lt;br /&gt;
          &lt;br /&gt;
          &lt;input class="submitbutton" type='submit' value='Submit'/&gt;
          &lt;br /&gt;
      &lt;/div&gt;
  &lt;/form&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>Results page that should display the email (result.html): </p>
  
  <pre><code>&lt;!DOCTYPE HTML&gt;
  &lt;html xmlns:th="http://www.thymeleaf.org"&gt;
  &lt;head&gt;
      &lt;title&gt;Thank you for your 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;Thank you for your submission!&lt;/h1&gt;
  
  &lt;p th:text="'Email: ' + ${signup.email}" /&gt;
  
  &lt;a href="/index"&gt;Submit another message&lt;/a&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>Controller:</p>
  
  <pre><code>@Controller
  public class controller1 {
  
      @RequestMapping (value = "/home")
      public String home(Model model) {
          return "index.html";
      }
  
      @RequestMapping(value = "/signup", method= RequestMethod.GET)
      public String signupForm(Model model) {
          model.addAttribute("signup", new emailInput());
          return "signup.html";
      }
  
      @RequestMapping(value = "/signup", method= RequestMethod.POST)
      public String signupSubmit(@ModelAttribute("email") emailInput email) {
          return "result.html";
      }
  
  
  }
  </code></pre>
  
  <p>Expected output should be the email variable displayed on the results page after it being gathered in the signup form.</p>
  
  <p>If you have a recommendation on how to better do what I am attempting, I am open to suggestions! I am very new to Spring/Thymeleaf but have had experience with Java/Jsp. Thank you for any help, please let me know if you need anything else to help!</p>