This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach 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 Murach's Java Servlets and JSP this week in the Servlets 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.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: can Layout JSPs in tiles be extended or reused ?
 
Similar Threads
tiles XML definition help
nested tiles
Tiles template
Access resources from jsp without using "bean:message" tag
Tiles problem