当前位置: 首页 > 知识库问答 >
问题:

使用此应用程序获取白色标记错误没有/Error的显式映射,因此您将此视为Spring boot中的一个后退

龙学
2023-03-14

我用的是Spring靴。我正在尝试使用thymeleaf模板。我用过龙目岛。我在运行该项目时收到白标签错误,该错误表示有一个意外错误(Type=internal Server error,status=500)。模板分析期间出错(模板:“class path resource[templates/design.html]”)org.thymeleaf.exceptions.templateInputException:模板分析期间出错(模板:“class path resource[templates/design.html]”)

这是我的项目结构输入图像描述这里

<!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>

我得到以下错误:

在此输入图像说明

共有1个答案

云何平
2023-03-14

您需要对表单操作进行编码:

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

标签错误页是一个通用的Spring Boot错误页,它在没有自定义错误页时显示。因此您需要为status 500错误设置一个页面:http://zetcode.com/springboot/whitelabelerror/

 类似资料: