If it is only "logged in" versus "not logged in",
why not use this simple 2-step process:

1. Set the tiles:put, tiles:add, etc. in your tiles xml
file to be the "not logged in" page.


2. In your action, subclass the TilesAction
(class org.apache.struts.tiles.actions.TilesAction)
and, in it's execute() method, override the tile
component if you are logged in, kind of like below:

// Always refer to documentation
// don't just try quoting me

if ( request.getUserPrincipal != null ) {
        // override "someTilePart", which in your tiles xml
        // file points to the appropriate not-logged-in JSP
        // for content display

        context.putAttribute("someTilePart", new String("/somePage.jsp");

        // and whatever else you require done to the tile.
}

Regards,
David

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]
Sent: Monday, May 31, 2004 11:37 PM
To: Struts Users Mailing List
Cc: [EMAIL PROTECTED]
Subject: RE: Struts/tiles: Run-time definition of which tile to include




-----Original Message-----
From: Struts Users Mailing List [mailto:[EMAIL PROTECTED]
Sent: Monday, May 31, 2004 4:00 PM
To: Struts Users Mailing List
Subject: Re: Struts/tiles: Run-time definition of which tile to include


On 31/5/04 2:52, "Michael McGrady" <[EMAIL PROTECTED]> wrote:

> Why don't you just use an
> ActionForward to go to the tiles definition in tiles-defs.xml you
> want?

Maybe I didn't explain myself well.  The point is that I don't want to have
one set of tile definitions for when they're logged in, and another set for
when logged out.  I want a single set of definitions, with the status tile
putting up appropriate content depending on whether they're logged in or
not.

One way would be to have a status tile that does conditional logic, as I
showed in my snippet.

But I thought there ought to be a simple way to do away with the conditional
page and do the whole thing in the definitions file: In my definition file,
I want to say "insert tile A or tile B depending on the value of bean X"

 Husted's book, and the Wrox one, are pretty poor on their coverage of
tiles, IMO.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]






---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to