• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

can Layout JSPs in tiles be extended or reused ?

 
Prasad murali
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 190
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
 
Prasad murali
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 190
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic