-
1. Re: Skinnability per user session
robertocarlos1 Jan 14, 2008 5:45 PM (in response to patrickmadden)create a skin bean that contain a property where you can put the name of selected skin by the client and in web.xml put something like that
This example asume that skin bean have a property of type string named skin<context-param> <param-name>org.ajax4jsf.SKIN</param-name> <param-value>#{skinBean.skin}</param-value> </context-param>
your skin bean have to be defined in the faces config<managed-bean> <managed-bean-name>skinBean</managed-bean-name> <managed-bean-class>yourpackage.SkinBean</managed-bean-class> <managed-bean-scope>session</managed-bean-scope> </managed-bean>
define the bean in session scope in faces-config.xml and when the user change the skin you only will need change the property value in the defined skin bean.
You can create an action in the skin bean that will be executed by the apply button and set the selected skin in the skin property of you bean -
2. Re: Skinnability per user session
patrickmadden Jan 14, 2008 6:10 PM (in response to patrickmadden)Thank You!
Works great and very simple.
PVM -
3. Re: Skinnability per user session
shandor Mar 31, 2008 10:21 AM (in response to patrickmadden)The RichFaces framework calls the setSkin(..) method and passes in the strin "DEFAULT" each time a new session starts...
which make the app starts always wth the default skin.
Any way to avoid that ?
Another thing I noticed when running it through a debbuger is that getSkin method is called lots of times for each request.
I wonder why that is. -
4. Re: Skinnability per user session
sergeysmirnov Mar 31, 2008 11:54 AM (in response to patrickmadden)I do not understand why you believe that skin is attached to the session. It is not. If you use EL in the web.xml to point to the managed bean, its setters and getters will be invoked the same way as any other managed bean getters and setters. Managed bean used as a skin bean is nothing more than the regular managed bean.