4 Replies Latest reply on Mar 31, 2008 11:54 AM by Sergey Smirnov

    Skinnability per user session

    Patrick Madden Newbie


      I see how to change the skin by using web.xml. However I'm looking for a way to change the skin per http session rather than per servlet context.

      I'm not interested in creating my own skin but just to use the prebuilt ones. I see the SkinBean object in the demo but I don't understand how that gets hooked into the rendering phase.

      I want to be able to do something like setSkin("deepMarine") but only have it affect a single users session.

      I'm sure its possible just don't know how ;)



        • 1. Re: Skinnability per user session
          Roberto Morales Newbie

          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


          your skin bean have to be defined in the faces config


          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
            Patrick Madden Newbie

            Thank You!

            Works great and very simple.


            • 3. Re: Skinnability per user session
              Adi Katz Novice

              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
                Sergey Smirnov Master

                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.