• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

Struts Tiles - Passing a parameter from layout template into a tile JSP?

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am creating a web app using Tomcat v4.1, JDK v1.4.2, and Struts v1.1 (with Tiles). The format/layout of each JSP in our web app is controlled by a Tiles layout template (call it Layout.jsp). Layout.jsp in turn "inserts" or uses Header.jsp as one of it's tiles to display a common header on each page. Also contained in Header.jsp is some code for a navigation menu at the top of the header/page ("i.e like -> Main | Download | Search | Help | Contact Us").

What I want to be able to do is somehow pass a parameter into Header.jsp that indicates which page I am currently on, so that I can disable that page link, and enable all of the other page links.

So to try and simplify this: I have a content JSP called Mainmenu.jsp. I want to setup a parameter in Mainmenu.jsp, that gets passed through Layout.jsp, and into Header.jsp so that I can disable just the "Main" link, and enable the remaining page links. I have looked over tiles tags but I am not sure how to go about doing this. Or maybe there is a better way to approach this all together ? Any help/ideas would be MOST appreciated!

Hopefully this makes sense - Thanks In Advance!

Mark


RELEVENT CODE SNIPPETS:

LAYOUT.JSP
--------------
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %>
<html:html>
<head>
<title><tiles:getAsString name="pagetitle" /></title>
<tiles:insert attribute="pageheader"/>
</head>
...

MAINMENU.JSP
-----------------
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %>

<tiles:insert page="/Layout.jsp" flush="true">

<tiles:put name="pagetitle" type="string"> <bean:message key="title.mainmenu" /> </tiles:put>

***** WANT TO PASS PARAMETER INTO THIS TILE! *****
<tiles:put name="pageheader" value="/Header.jsp" />

HEADER.JSP
--------------
***** WHAT STATEMENT(s) WOULD I NEED TO GET THE PARAMETER TO PROPERLY SETUP THE LINKS ? *****
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic