2 Replies Latest reply on Aug 20, 2009 9:26 AM by Leo van den berg

    Setting Skin on Login.xhtml

    Casey Boyd Newbie

      Here is the problem....


      I need to be able to set the skin dynamically on the login.xhtml page....


      So...



      http://localhost:8080/myapp/login.seam?sp=skyBlue
      http://localhost:8080/myapp/login.seam?sp=emeraldTown
      http://localhost:8080/myapp/login.seam?sp=skinName





      Using the SkinBean doesn't seem to work....



      thanks


      indy

        • 1. Re: Setting Skin on Login.xhtml
          Casey Boyd Newbie

          I don't have to use the Request to pass the Skin Name.....


          Any ideas?


          thanks


          Indy

          • 2. Re: Setting Skin on Login.xhtml
            Leo van den berg Master

            There are a number of tricks to do this. I myself do the following:


            Line in web.xml


            <context-param>
              <param-name>org.richfaces.SKIN</param-name>
              <param-value>#{skinAction.skin}</param-value>
             </context-param>
             <context-param>




            A user has a property skinName which is retrieved when you log in and used when this bean is called, but using a query parameter hould work the same.



            @Name("skinAction")
            @Scope(ScopeType.SESSION)
            public class SkinAction implements Serializable {
            
                 @In(required=false)
                 User currentUser;
                 
                 private static final long serialVersionUID = 9018532822592154331L;
            
                 String skin = "DEFAULT";
            
                 public void personalSkin(){
                      if (currentUser == null) return;
                      else {
                           skin = currentUser.getSkinName();
                      }
                 }
            
                 public String getSkin() {
                      if (skin == null) return "DEFAULT";
                      else return skin;
                 }
            
                 public void setSkin(String skin) {
                      this.skin = skin;
                 }
                 
            }