thymeleaf可以像jsp一样使用<jsp:include page =“”>?

时间:2017-05-31 07:36:09

标签: spring jsp thymeleaf

在jsp中,我们可以使用:

的index.jsp

<body>
    <div>header</div>
   <jsp:include page="/menus"></jsp:include>
   <div>bottom</div>
<body>

MenuController.java

@Controller
public class MenuController{
    @GetMapping("/menus")
    public String menus(Model model){
        model.addAttribute("menuList",list);
        return "/menu/menu_page";
    }
}

/menu/menu_page.jsp

<c:forEach items="${menuList}" var="item" varStatus="index">
    .........
</c:foreach>

现在,在Thymeleaf可以这样吗?包含控制器网址? 我使用Thymeleaf的<th:replace><th:include>都无法做到。

0 个答案:

没有答案