This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one 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 The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript 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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: can Layout JSPs in tiles be extended or reused ?