Struts Tiles

Discussion in 'Java' started by Sean Chou, Jul 6, 2003.

  1. Sean Chou

    Sean Chou Guest

    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).
    Sean Chou, Jul 6, 2003
    #1
    1. Advertising

  2. Sean Chou

    Sean Chou Guest

    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).


    "Sean Chou" <> wrote in message
    news:i4ZNa.3466986$...
    > 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).
    >
    >
    >
    >
    Sean Chou, Jul 11, 2003
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jack
    Replies:
    7
    Views:
    2,554
  2. Jun
    Replies:
    1
    Views:
    1,338
    Wendy S
    Nov 17, 2003
  3. Conor
    Replies:
    0
    Views:
    934
    Conor
    Jan 15, 2004
  4. gilgantic

    Struts: Embedded Tiles

    gilgantic, Feb 4, 2004, in forum: Java
    Replies:
    0
    Views:
    425
    gilgantic
    Feb 4, 2004
  5. Rich M
    Replies:
    0
    Views:
    2,049
    Rich M
    Mar 5, 2004
Loading...

Share This Page