gpt4 book ai didi

java - Spring Boot Thymeleaf 服务器错误,状态=500

转载 作者:行者123 更新时间:2023-12-01 18:41:46 25 4
gpt4 key购买 nike

我有 Spring Boot 应用程序,它可以在本地主机上运行。但是在我的服务器上的某些页面上部署 .war 文件后,我收到:

Whitelabel Error Page
This application has no explicit mapping for /error, so you are seeing this as a fallback.

Sun Jan 26 15:49:46 CET 2020
There was an unexpected error (type=Internal Server Error, status=500).
Error resolving template [/user/instruction/disable-script], template might not exist or might not be accessible by any of the configured Template Resolvers

在本地主机上,此页面正在运行。问题仅出在服务器上。

enter image description here

禁用脚本.html:

<html xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
xmlns:th="http://www.thymeleaf.org"
layout:decorate="~{fragments/user/layout}">
<head>
<title>...</title>
</head>
<body>
<div layout:fragment="content" th:remove="tag">
.....
</div>
</body>
</html>

Controller 片段:

 @RequestMapping(value = "/user/instruction/disable-script", method = RequestMethod.GET)
public String instructionDisableScript(WebRequest request, Model model) {
return "/user/instruction/disable-script";
}

服务器上的某些页面正在运行。我不知道为什么有些人会抛出这个错误 500...

最佳答案

这可能是因为部署后,模板的查找发生了变化,请尝试使用以下配置运行服务器:spring.thymeleaf.prefix=classpath:/templates/

关于java - Spring Boot Thymeleaf 服务器错误,状态=500,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59919934/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com