Question

It concerns the following:

  1. There is a base stylesheet.css for the web site (by using a <link> tag).
  2. Depending on user is logged in the skin changes through SkinBean.setSkin("SKIN") when the user enters some parts of the web site.
  3. If the skin changes than also the loaded style sheet should be changed in stylesheet-alt.css.

Is there a quick and simple solution for changing the style sheet depending on used skin in RichFaces?

I will be glad if someone helps.

(This question is not about how to change the skin in RichFaces in general)

Was it helpful?

Solution

Use <a4j:loadStyle> instead of <link> tag and use rendered attribute as below.

<a4j:loadStyle src="stylesheet.css" rendered="#{myBean.booleanProperty}"/>
<a4j:loadStyle src="stylesheet-alt.css" rendered="#{!myBean.booleanProperty}"/>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top