Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/305.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 在spring boot中将文本值传递给thymeleaf视图_Java_Spring Boot_Controller_Thymeleaf - Fatal编程技术网

Java 在spring boot中将文本值传递给thymeleaf视图

Java 在spring boot中将文本值传递给thymeleaf视图,java,spring-boot,controller,thymeleaf,Java,Spring Boot,Controller,Thymeleaf,我们在${title}页面 我试图在html标记中显示标题。有没有办法在spring boot中做到这一点?是的,所以在Thymeleaf中这是绝对可能的。您可以使用title标记和text参数更改标题。需要注意的是,th将代表thymeleafxml名称空间。同样重要的是要注意,这可以通过以下方式完成 只需将th:text属性用作th:text=“${title} 文档:使用th:text的参数 我们在there is..read.@AxelKong您尝试过这个解决方案吗? @RequestM

我们在${title}页面


我试图在html标记中显示标题。有没有办法在spring boot中做到这一点?

是的,所以在Thymeleaf中这是绝对可能的。您可以使用title标记和text参数更改标题。需要注意的是,
th
将代表thymeleafxml名称空间。同样重要的是要注意,这可以通过以下方式完成


只需将th:text属性用作
th:text=“${title}


文档:

使用th:text的参数


我们在there is..read.@AxelKong您尝试过这个解决方案吗?

@RequestMapping(value = "alphabet")
public String index(Model model) {
    model.addAttribute("title", "Alphabet");
    return "categories/index";