首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >弹簧不起作用时胸腺生长因子依赖性

弹簧不起作用时胸腺生长因子依赖性
EN

Stack Overflow用户
提问于 2022-04-08 04:58:41
回答 1查看 424关注 0票数 1

我从springboot的一个项目开始,我有一个以前从未见过的错误,我还没能解决它,这是因为胸腺细胞依赖关系不起作用,我和intellij idea社区版一起工作。它不允许我使用th:文本,请看图片。我删除了这个项目并重新下载了几次,删除了m2文件夹,但是没有什么对我有用。

这是我的控制器:

代码语言:javascript
复制
@Controller
public class IndexController {

@GetMapping(value = "/index")
public String index(Model model){
    model.addAttribute("titulo", "nombre");
    return "index";
}
}

这是de index.html

代码语言:javascript
复制
<!DOCTYPE html>
<html lang="en" xmlns:th="http://thymeleaf.org">
<head>
<meta charset="UTF-8">
<title>th:text="${titulo}"</title>
</head>
<body>

</body>
</html>

当我运行代码localhost不向我显示正确的信息时,我已经安装了依赖项。

在这里输入图像描述

代码语言:javascript
复制
<dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-thymeleaf</artifactId>
    </dependency>

在这里输入图像描述

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2022-04-08 06:02:32

您的模板被用作静态资源。控制器对/index有一个映射,但是您已经访问了http://localhost:8080。要么将映射更改为@GetMapping("/"),要么访问http://local host:8080/index。您还应该检查index.html在项目中的位置。应该在src/main/resources/templates里。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/71791868

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档