我最近在春天开始使用百里香模板引擎.我想要实现的是 – 如果我的控制器就是这个
@RequestMapping(value="/",method=RequestMethod.GET)
public String index() {
return "homePage";
}
然后我想在homePage.html中编写HTML代码而没有像head,title,body等完整的HTML定义.
我最近在春天开始使用百里香模板引擎.我想要实现的是 – 如果我的控制器就是这个
@RequestMapping(value="/",method=RequestMethod.GET)
public String index() {
return "homePage";
}
然后我想在homePage.html中编写HTML代码而没有像head,title,body等完整的HTML定义.
注意:我已经看过这些例子了
> http://www.thymeleaf.org/doc/articles/layouts.html
> https://looksok.wordpress.com/2014/06/28/spring-website-layouts-ssi-with-thymeleaf-templates/
> http://blog.codeleak.pl/2013/11/thymeleaf-template-layouts-in-spring.html
Controller指向index.html并给出“内容页面”的属性
@RequestMapping(value={"/"})
public String root(Locale locale,ModelMap model) {
model.addAttribute("content","helloWorldView");
return "index";
}
这是我的index.html:
片段/了header.html
片段/ footer.html
在我的文件夹视图中,我获得了包含内容的所有视图
意见/ helloWorldView.html:
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。