/**
* @author think
*/
@Controller
@RequestMapping("springboot")
public class HelloController {
@RequestMapping("test")
public String hello(Model model){
model.addAttribute("username", "<a href=''>数据</a>");
return "index";
}
}
想要在html的页面拿到username的值使用原来的语法是拿不到的:
<span th:text="${username}"></span>
要使用这个:
<span th:utext="${username}"></span>
utext可以解析字符串里的HTML标签