[jboss-user] [JBoss Portal] - Re: Changing theme dynamically

bvogt do-not-reply at jboss.com
Fri Feb 13 03:29:33 EST 2009


we did it by using a custom:
org.jboss.portal.core.aspects.controller.PageCustomizerInterceptor
which determines the users theme and provides it into the request:
...
  | serverInvocation.getServerContext().getClientRequest().setAttribute(ATTR_VIEW_THEME, theme);
  | ...
and a custom:
org.jboss.portal.theme.tag.ThemeTagHandler
which reads the theme out of the request:
...
  |       PageContext pageContext = (PageContext) getJspContext();
  |       HttpServletRequest request = (HttpServletRequest) pageContext.getRequest();
  |       PortalTheme theme = (PortalTheme) request.getAttribute(PageCustomizerInterceptor.ATTR_VIEW_THEME);
  | ...
and writes its elements onto the page:
...
  | JspWriter outWriter = pageContext.getOut();
  | Iterator it = theme.getElements().iterator();
  | 
  | while (it.hasNext())
  | {
  |   ThemeElement te = (ThemeElement) it.next();
  |   String elementString = te.getElement();
  | 
  | ...
  | 
  |   outWriter.println(elementString);
  | }
  | ...

View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4209791#4209791

Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4209791



More information about the jboss-user mailing list