Monday, 15 July 2013

jsp - How to pass parameter from body page to header page in tiles? -



jsp - How to pass parameter from body page to header page in tiles? -

my tiles layout page has 3 section i.e. header, body , footer.

the layout such title of page has defined in header. there way can title body page header page?

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>

if see header.jsp there page title. ideally want placeholder on there should replaced page title defined in each body.jsp

jsp tiles

No comments:

Post a Comment