PDA

View Full Version : [Sitemesh & views] How to apply different decorator on different views ?


PascalAlberty
Jun 12th, 2007, 04:07 PM
Hi,

I would like to apply a specific decorator for a specific view for one controller.

Typically, my controller is a MultiActionFormController. Depending of the success (or not) of the action execution,, different views are shown. Depending of these views, I would like to apply a different decorator.

Actually, decorator are choosen based on access point (controller url mapping) and not based on the view name.

How can I do this if possible ?

Thanks

PascalAlberty
Jun 12th, 2007, 04:23 PM
It's so simple that I found by myself ;-)

One solution is to use another DecoratorMapper (http://www.opensymphony.com/sitemesh/dm.html)
for example the PageDecoratorMapper (http://www.jdocs.com/sitemesh/2.1/api/com/opensymphony/module/sitemesh/mapper/PageDecoratorMapper.html)

I specify a decorator name to be used directly in my view (JSP) using the following tag:
<meta name="decorator" content="decorator_to_be_used">

That's all.

If someone has another solution ... please comment