为什么胸腺tag标签:文本不打印?
在MemberPage.html中,我有一个标签th:text =“ $ {username}”,但是当我在服务器上运行页面时,它不会显示该值,为什么?
会员page.html
<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>HOME</title>
</head>
<body>
<div th:text="${username}"></div>
控制器
String username = "Username";
HttpSession session = request.getSession();
session.setAttribute("username",username);
RequestDispatcher rd = request.getRequestDispatcher("MemberPage.html");
rd.forward(request, response);
in MemberPage.html i have a tag th:text="${username}", but it doesn't display the value when i run the page on the server, why?
MemberPage.html
<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>HOME</title>
</head>
<body>
<div th:text="${username}"></div>
The Controller
String username = "Username";
HttpSession session = request.getSession();
session.setAttribute("username",username);
RequestDispatcher rd = request.getRequestDispatcher("MemberPage.html");
rd.forward(request, response);
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
请更改您的代码
从:
到:
Please change your code
from:
to: