1

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.

Community
  • 1
  • 1
user
  • 3,058
  • 23
  • 45

1 Answers1

2

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}" />
sp00m
  • 47,968
  • 31
  • 142
  • 252
  • Yes, I was thinking the same way: to change the content through request, but still I have to try, if it is going to change on runtime. Thank you. – user Mar 13 '13 at 17:11
  • Yeah, it works, but it has some glitches: when I change the decorator, so for the first time the resources fail to load and I have to reload the page with the cache clearing. A bit weird, tho. Still figuring out, what's happening. – user Mar 14 '13 at 17:09