使用此应用程序获取白标签错误没有针对/ error的显式映射,因此您将其视为Spring启动中的后备选项

问题描述 投票:0回答:1

我正在使用Spring Boot。我正在尝试使用百里香模板。我用过龙目岛。运行表示存在意外错误的项目时出现白色标签错误(类型=内部服务器错误,状态= 500)。模板解析期间发生错误(模板:“类路径资源[templates / design.html]”)org.thymeleaf.exceptions.TemplateInputException:模板解析期间发生错误(模板:“类路径资源[templates / design.html]”)

这是我的项目结构enter image description here

<!DOCTYPE html>
<html 
      xmlns:th="http://www.thymeleaf.org">
  <head>
    <title>Taco Cloud</title>
    
  </head>

  <body>
    <h1>Design your taco!</h1>
    

    <form method="POST" th:object="${design}">
    <div class="grid">
      <div class="ingredient-group" id="wraps">
      <h3>Designate your wrap:</h3>
      <div th:each="ingredient : ${wrap}">
        <input th:field="*{ingredients}" type="checkbox"
               th:value="${ingredient.id}"/>
        <span th:text="${ingredient.name}">INGREDIENT</span><br/>
      </div>
      </div>

          <div class="ingredient-group" id="proteins">
      <h3>Pick your protein:</h3>
      <div th:each="ingredient : ${protein}">
        <input th:field="*{ingredients}" type="checkbox"
               th:value="${ingredient.id}"/>
        <span th:text="${ingredient.name}">INGREDIENT</span><br/>
      </div>
      </div>

          <div class="ingredient-group" id="cheeses">
      <h3>Choose your cheese:</h3>
      <div th:each="ingredient : ${cheese}">
        <input th:field="*{ingredients}" type="checkbox"
               th:value="${ingredient.id}"/>
        <span th:text="${ingredient.name}">INGREDIENT</span><br/>
      </div>
      </div>

          <div class="ingredient-group" id="veggies">
      <h3>Determine your veggies:</h3>
      <div th:each="ingredient : ${veggies}">
        <input th:field="*{ingredients}" type="checkbox"
               th:value="${ingredient.id}"/>
        <span th:text="${ingredient.name}">INGREDIENT</span><br/>
      </div>
      </div>

          <div class="ingredient-group" id="sauces">
      <h3>Select your sauce:</h3>
      <div th:each="ingredient : ${sauce}">
        <input th:field="*{ingredients}" type="checkbox"
               th:value="${ingredient.id}"/>
        <span th:text="${ingredient.name}">INGREDIENT</span><br/>
      </div>
      </div>
      </div>

      <div>


      <h3>Name your taco creation:</h3>
      <input type="text" th:field="*{name}"/>
      <br/>

      <button>Submit Your Taco</button>
      </div>
    </form>
  </body>
</html>

并且我收到以下错误:

enter image description here

我正在尝试学习Spring Boot。非常感谢您的帮助

java spring spring-boot thymeleaf lombok
1个回答
0
投票

您需要编写表单操作代码:

 <form method="POST" th:object="${design}" th:action="@{taco/save}">

WhiteLabel错误页面是通用的Spring Boot错误页面,当不存在自定义错误页面时显示。因此,您需要为状态500错误设置页面:http://zetcode.com/springboot/whitelabelerror/

© www.soinside.com 2019 - 2024. All rights reserved.