Struts Tiles

S

Sean Chou

Hi all,

I've been hashing through the docs and newsgroups looking for this, but have
had no luck so hope that someone here can help out. I'm trying to use a base
layout as a "master" layout for a series of sub-layouts. The master layout
should be something like:

<definition name=".layout.base" path="/layouts/base_layout.jsp">
<put name="title" value="My Default Title"/>
<put name="menu" value="/default-menu.jsp"/>
</definition>

With <tiles:insert...> tags for title, menu, and main.

One of the sub-layouts would be something like:

<definition name=".layout.sub1" extends=".layout.base">
<put name="main" value="/default-desktop-body.jsp"/>
</definition>

With additional <tiles:insert...> tags for body and sidebar in the
desktop_layout.jsp.

I'd then like to access the sub1 layout like:

<definition name=".desktop.main" extends=".layout.sub1" >
<put name="title" value="My Real Desktop" />
<put name="menu" value="/real-menu.jsp"/>
<put name="body" value="/real-desktop-body.jsp"/>
<put name="sidebar" value="/real-sidebar.jsp"/>
</definition>

The problem is that the <tiles:...> tags in default-desktop-body.jsp can't
access the attributes of the definition. I realize that attributes are
specific to a tile and so forth, but am wondering if there is an elegant way
of achieving my goal without creating the sub-layouts as the primary
definitions (which would lead to a fair amount of repetitive layout HTML).
 
S

Sean Chou

Well, I never did come up with a satisfactory way to use Tiles to accomplish
what I wanted so I ended up writing my own set of custom tags to provide a
easier and more powerful templating mechanism for my needs. Tiles is great
for portals but makes a web application look like code soup with a million
artifacts between the JSPs, included tiles, and XML definitions (not to
mention the need to create forwards in Struts for each view if you want
direct access).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,734
Messages
2,569,441
Members
44,832
Latest member
GlennSmall

Latest Threads

Top