Raible's Wiki
Raible Designs AppFuseHomepage- Korean - Chinese - Italian - Japanese QuickStart Guide User Guide Tutorials Other ApplicationsStruts ResumeSecurity Example Struts Menu
Set your name in
UserPreferences
Referenced by
JSPWiki v2.2.33
Hide Menu |
In your tiles-config.xml file, configure your base definition to contain the following putList's: <!-- Base layout definition --> <definition name="baseLayout" path="/layouts/baseLayout.jsp"> ... <!-- Default Javascript File --> <putList name="scripts"> <add value="/scripts/global.js"/> </putList> <!-- Default Stylesheet File --> <putList name="styles"> <add value="/styles/default.css"/> </putList> </definition> Then in your baseLayout.jsp file, add the following to the <head>:<%-- Get Javascript List --%> <tiles:useAttribute id="scriptList" name="scripts" classname="java.util.List" ignore="true"/> <c:forEach var="js" items="${scriptList}"> <script type="text/javascript" src="<%=request.getContextPath()%><c:out value="${js}"/>"></script> </c:forEach> <%-- Get List of Stylesheets --%> <tiles:useAttribute id="styleList" name="styles" classname="java.util.List" ignore="true"/> <c:forEach var="css" items="${styleList}"> <link rel="stylesheet" type="text/css" media="all" href="<%=request.getContextPath()%><c:out value="${css}"/>" /> </c:forEach> Pretty slick huh? If you want to override the scripts or styles in your child definitions, you will need to override the entire list, rather than just adding to the default. This is a limitation of the putList in Tiles. Notes: A couple of things could stand to be corrected in this short tutorial.
<tiles:useAttribute name="styles" ignore="true"/> <c:forEach var="css" items="${styles}"> <link rel="stylesheet" type="text/css" media="all" href="<html-el:rewrite page="${css}"/>" /> </c:forEach>~ Mojavelinux
|