سؤال

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)

هل كانت مفيدة؟

المحلول

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}"/>
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top