2 Replies Latest reply: Dec 26, 2011 10:49 AM by Lu Han RSS

how to reload/refresh css file after ajax/partial submit when the css is changed

Lu Han Newbie

See the below test, when the text named ecssText is updated, the css is not changed.

I wish a way to refresh the css file, here.

Thanks!

css file:

    .elStyle{

              color:#{ecss.color};

    }

 

 

jsf page:

    ...

         <h:outputStylesheet name="jsfrf.css" library="css" />

    </h:head>

   

    <h:body>

    ...

                        <a4j:jsFunction name="elTest" render="ecssText">

                                  <a4j:param name="color" assignTo="#{ecss.color}"/>

                        </a4j:jsFunction>

    ...

   

                        <h:outputText id="ecssText" value="#{ecss.color}" styleClass="elStyle"/>

                        <a4j:commandButton value="to red" onclick="elTest('red');"/>

                        <a4j:commandButton value="to blue" onclick="elTest('blue');"/>

 

class:

    @ManagedBean(name = "ecss")

    @ApplicationScoped

    public class ECSS {

              private String color;

   

              @PostConstruct

              public void init() {

                        this.color = "blue";

              }

   

              public String getColor() {

                        return color;

              }

   

              public void setColor(String color) {

                        this.color = color;

              }

    }