• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Paul Clapham
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Roland Mueller
  • Piet Souris
Bartenders:

can Layout JSPs in tiles be extended or reused ?

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Ranch Hand
Posts: 190
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
 
Prasad murali
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic