Re: Integration with WebWork

"Victor Salaman" <[email protected]>
Newsgroups gmane.comp.web.sitemesh.general
Message-ID <[email protected]>
At last, someone found the secret to <content tag=xxx"> :)


----Original Message Follows----
From: Mike Cannon-Brookes <[email protected]>
To: "'[email protected]'" 
<[email protected]>
Subject: Re: [Opensymphony-sitemesh] Integration with WebWork
Date: Tue, 9 Mar 2004 22:44:59 +1100

Juergen,

There are two approaches to this really.

1) Putting the menus within the decorated page (how Confluence does it)

In your HTML, put something like this:
<content tag="menu">
... menu HTML here using WW tags, i18n etc...
</content>

Now in your decorator you can just use:
<decorator:getProperty name="page.menu" /> (I think)

or in Velocity:

$page.getProperty('page.menu')

2. Alter WW2 (how JIRA does it with WW1)

This is a more generic approach which allows you to use any WW tag, the 
value stack etc within your decorator.

The problem here (as you've found) is that the value stack is no longer 
present in the decorator. Basically, the control flow is something like 
this:

1. SiteMesh Filter starts gathering the request stream
2. WW ServletDispatcher runs, executes action and dispatches to view
3. View runs
4. ServletDispatcher cleans up the value stack
5. SiteMesh filter finishes gathering the request, and dispatches to the 
decorator
6. Decorator runs and complete result is returned

This is a problem, because in step 4 the value stack is cleaned up, 
therefore in step 6 the decorator doesn't have the value stack to use.

The way to get around this is to wrap a filter around the whole chain (ie 
above SM filter in the filter stack) which adds a request attribute to tell 
WW _not_ to clean up the value stack. Step 4 then doesn't happen, and 
instead you clean up the value stack in your filter during step 6.5.

Does that make sense? :) (apologies - almost 11pm here)

Any questions, please ask.

Cheers,
Mike

On 09/03/2004, at 6:39 PM, Donnerstag, Juergen wrote:

>
>I've just started using webwork2 and sitemesh. If the following is a stupid
>question, please apologize.
>
>I've create a page layout using sitemesh with header, left menu and main
>area. Because there is meant to be always a menu bar, I put the menu
>definition into the sitmesh template. That works fine. Next thing was to
>localize the menu and the tooltips. WebWork provides some simple means to 
>do
>that: tags (i18n and text) and ActionSupport, a base implementation for 
>most
>Actions provides similiar methods. Unfortunately, due to the way sitemesh
>works, the WW2 action instance is no longer available. Lucky me, most of
>methods required for localization are static methods. But now my template
>html code does no longer look like typical WW2 html and I always to be 
>aware
>of that while making changes. That is akward.
>
>Next step was to personalize (disable, modify) the menu based on the users
>role. And the same problem arose. Based on the way sitemesh works there
>seems to be no way to access the WW2 action object (which is responsible 
>for
>the main area) from within the sitemesh template. Is that correct? The
>solution would be to move the menu out of the template and into each and
>every jsp file? That isn't a very solution too? Any ideas?
>
>thanks for your support
>Juergen
>
>
>
>-------------------------------------------------------
>This SF.Net email is sponsored by: IBM Linux Tutorials
>Free Linux tutorial presented by Daniel Robbins, President and CEO of
>GenToo technologies. Learn everything from fundamentals to system
>administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
>_______________________________________________
>Opensymphony-sitemesh mailing list
>[email protected]
>https://lists.sourceforge.net/lists/listinfo/opensymphony-sitemesh
>



-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
_______________________________________________
Opensymphony-sitemesh mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensymphony-sitemesh

_________________________________________________________________
Add photos to your e-mail with MSN 8. Get 2 months FREE*. 
http://join.msn.com/?page=features/featuredemail



-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.