Search code examples
javasitemesh

Sitemesh change decorator on runtime


My greetings!

The question is pretty short: is there any way to change the decorator during runtime? For example, I have a dropdown menu with some "decorator styles", so when the user chooses different style, it will change the decorator.

If you have any useful links on this topic, I'd be very grateful.

Found this thread - SiteMesh: Changing the content-type of the response - but still, no help.


Solution

  • I know you can use a meta HTML tag to specify which decorator you want to use with your JSP files. For example in the file login.jsp where I need the login decorator:

    <head>
        <meta name="decorator" content="login" />
        <!-- where "login" is the name of the decorator -->
    </head>
    

    So, I never tried yet, but you could probably give the name of the decorator through a POST or a GET parameter, and using it within the meta tag:

    <meta name="decorator" content="${decoratorName}" />