亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定

sts中thymeleaf中顯示不出來

我在sts中使用thymeleaf頁面起不了作用呢

application中的配置

spring.thymeleaf.prefix=classpath:/templates/

spring.thymeleaf.suffix=.html

spring.thymeleaf.mode=HTML5

spring.thymeleaf.encoding=UTF-8

spring.thymeleaf.content-type=text/html

spring.thymeleaf.cache=false

html頁面

<!DOCTYPE html>

<html>

<head>

<meta charset="UTF-8"/>

<title>Insert title here</title>

</head>

<body>

<h1 th:text="${hello}">Hello</h1>

</body>

</html>

控制器

@Controller

@EnableAutoConfiguration

public class StudentController {

@RequestMapping("/f")

public String free() {

Map<String,Object> map = new HashMap<String, Object>();

map.put("hello","user1");

return "freemarker/index";

}

}

}

頁面顯示不了user1

歡迎小伙伴速速解答



正在回答

1 回答

你頁面中可以獲取Map中的值,頁面一般應該是獲取request域中的,在返回到頁面不重定向的情況下,重定向的情況,request域中的值會獲取不到,你這個直接返回到頁面,沒有把值放到request域中,或者放入model中也可

0 回復 有任何疑惑可以回復我~

舉報

0/150
提交
取消

sts中thymeleaf中顯示不出來

我要回答 關注問題
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號