*
The moose likes Struts and the fly likes tile question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "tile question" Watch "tile question" New topic
Author

tile question

Hong Yi
Greenhorn

Joined: Feb 13, 2008
Posts: 11
How do I add action to a common element (header.jsp) for tile layout?

thanks
Doug Slattery
Ranch Hand

Joined: Sep 15, 2007
Posts: 294
Hi Hong Yi,

If I understand your question, you want to use header.jsp in several tiles?.?.

That being the case, you can extend a tile from a parent. Example:

Suppose you have an action mapping in your struts-config.xml to display your home page, which you want to incorporate header.jsp


In your tiles-defs.xml, do the following:



In this case, tile:showhome inherits tile:layout which contains header.jsp.

Now, in layout.jsp, do something like this:



Now, you can reuse layout by extending it in other tiles and changing the page.body name attribute to whatever jsp applies for the other pages.

I hope that answers your question...
Aloha,
Doug

-- Nothing is impossible if I'mPossible
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: tile question
 
Similar Threads
Unable to find the path attribute files
tiles struts
Post your photo!!
Java Love
Including JSPX in other JSPX