This week's book giveaway is in the Java 8 forum.
We're giving away four copies of Java 8 in Action and have Raoul-Gabriel Urma, Mario Fusco, and Alan Mycroft on-line!
See this thread for details.
The moose likes Struts and the fly likes can Layout JSPs in tiles be extended or reused ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "can Layout JSPs in tiles be extended or reused ?" Watch "can Layout JSPs in tiles be extended or reused ?" New topic
Author

can Layout JSPs in tiles be extended or reused ?

Prasad murali
Greenhorn

Joined: Feb 07, 2007
Posts: 4
Hi,
I have lots of Layout JSPs in my application like

Col2Layout.jsp
<%@taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %>
<tiles:insert attribute="header"/>
<tiles:insert attribute="leftContent"/>
<tiles:insert attribute="rightContent"/>
<tiles:insert attribute="footer"/>

Col1Layout.jsp
<%@taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %>
<tiles:insert attribute="header"/>
<tiles:insert attribute="Content"/>
<tiles:insert attribute="footer"/>

I want to have header and footer in a seperate Layout jsp and want to extent that in other jsp's rather than using <tiles:insert> tag for header and footer in all the layout jsp's.Can Layout JSPs in tiles be extended or inherited?
Chris Boldon
Ranch Hand

Joined: Aug 10, 2006
Posts: 190
Prasad murali
Greenhorn

Joined: Feb 07, 2007
Posts: 4
Thanks Chris.But is there a way of reusing

<tiles:insert attribute="header"/>
<tiles:insert attribute="footer"/>

in all the Layout JSPs?
Chris Boldon
Ranch Hand

Joined: Aug 10, 2006
Posts: 190
Yes, like I posted....you use a base definition. Then you create a new definition that extends base and includes the new elements that are unique for the instance.

Then in your struts config you set the forward to the definition. The definition will load the JSPs. I hope you aren't using tiles tags directly in your JSPs. The tiles tags should call the JSPs through a layout.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: can Layout JSPs in tiles be extended or reused ?
 
Similar Threads
Tiles problem
tiles XML definition help
Tiles template
nested tiles
Access resources from jsp without using "bean:message" tag