如何将参数从正文页面传递到图块中的标题页面?

时间:2013-02-13 08:45:16

标签: jsp tiles

我的图块布局页面有三个部分,即页眉,正文和页脚。

布局是必须在标题中定义页面标题。有什么方法可以从正文页面标题到标题页吗?

tiles.xml

<definition name="mobile.base.definition" template="/WEB-INF/jsp/mobile/layout/baseLayout.jsp">
   <put-attribute name="header" value="/WEB-INF/jsp/mobile/common/header.jsp" />
   <put-attribute name="menu" value="/WEB-INF/jsp/mobile/common/menu.jsp" />
   <put-attribute name="footer" value="/WEB-INF/jsp/mobile/common/footer.jsp" />
</definition>

layout.jsp

    <%@ page contentType="text/html; charset=utf-8" language="java" %>

<%@ taglib uri="http://tiles.apache.org/tags-tiles" prefix="tiles" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://www.springframework.org/tags" prefix="spring"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    </head>

    <body>
        <div id="wrap">
            <header id="header">
                <tiles:insertAttribute name="header"  />
            </header>

            <div id="mainPage">
                <div class="container">
                    <div class="row-fluid">
                        <div class="span12">
                            <tiles:insertAttribute name="body" />
                        </div>      
                    </div>
                </div>
            </div>
        </div>
        <footer id="footer">
            <tiles:insertAttribute name="footer"  />
        </footer>

    </body>
</html>

header.jsp中

    <header id="header">
<div class="container-fluid">
 <div class="row-fluid">
    <aside class="span1">
        <div class="btn-group menu-highlight">
            <button class="btn btn-link dropdown-toggle" data-toggle="dropdown">
                <span>+</span>
            </button> 
           <div class="dropdown-menu">
            <h1><img src="img/logo-text.jpg" width="106" height="23" alt=" " /> <i class="icon-remove icon-white"></i></h1>
            <ul class="">
            <li><a href="#" class="active"><span>Home</span> <b><img src="img/icon-home.png" width="19" height="17" alt=" " /></b></a></li>
                <li><a href="#"><span>Account</span> <b><i class="icon-star"></i></b></a></li>
                <li><a href="#"><span>Contact</span> <b><i class="icon-comment"></i></b></a></li>                                
                <li><a href="#"><span>Calender</span> <b><i class="icon-calendar"></i></b></a></li>                                                
            </ul>
           </div>

        </div>
    </aside>
    <section class="span11 head-right-panel">
        <header>
         <hgroup class="span8"><h1 class="ellipsis"> Page Title</h1></hgroup>
        <span class="logo">
            <img src="img/logo.jpg" width="118" height="41" alt=" " />  
        </span>    
        </header>
    </section>
  </div>  
</div>
</header>

如果你看到header.jsp有页面标题。理想情况下,我们需要一个占位符,它应该被每个body.jsp中定义的页面标题所取代.jsp

0 个答案:

没有答案