Nav菜单的母版页 - Spring MVC的部分视图?

时间:2013-07-30 16:45:30

标签: java jsp spring-mvc

我正在使用spring mvc 3.2.2。我有一个主索引页面,其中包含登录/用户信息的标题以及导航菜单和页脚(以及它自己的内容)。

> http://localhost:8080/mywebsite/home/index.jsp

<html>....
<head>...
<body>
   <headerbar>...
   <navmenu>...
   <!-- Content here....-->
   <footer>
<body>

现在我将添加新的控制器和操作,如何重用标题/导航菜单和页脚,以便我不必在每个附加页面中添加它?

因此,对于我的用户控制器页面,我想要做的就是呈现用户信息而不包括标题/导航/页脚等。

> http://localhost:8080/mysite/account/user/8585

<!-- Only include the following but have it render as body() where nav menu/footer/header are already included in some partial view or master page -->
<h4>User Account</h2>
<user>${username}</user>
<firstname>${firstname}</firstname>

我该如何做到这一点?

<html>....
<head>...
<body>
   <headerbar>...
   <navmenu>...
     RenderBody?() <!-- Content here from any page include home/index.jsp and account/user....-->
   <footer>
<body>

1 个答案:

答案 0 :(得分:0)

您需要某种模板引擎来解决此问题,例如Apache Tiles

相关问题