title: Rendering of an element depending on primefaces rating
body: <p>I started using primafaces and I came up with the following scenario. The user rates and element and if the rating is valid then a span block appears or it hides depending the case. I am based on the example here: (<a href="http://www.primefaces.org/showcase/ui/input/rating.xhtml" rel="nofollow">http://www.primefaces.org/showcase/ui/input/rating.xhtml</a> ) with the ajax approach. Note that a rate is valid if the user clicks on any star. So here's what I've done so far:</p>
  
  <pre><code>&lt;h:form&gt;
                  &lt;p:panelGrid&gt;
                      &lt;p:row&gt;
                          &lt;p:column&gt;
                              &lt;p:rating value="#{searchBean.dateWeight}"&gt;
                                  &lt;p:ajax event="rate" listener="#{searchBean.addDatetoWeights}"
                                      update="dates" render="dates" /&gt;
                                  &lt;p:ajax event="cancel"
                                      listener="#{searchBean.removeDatefromWeights}"
                                      update="dates" /&gt;
                              &lt;/p:rating&gt;
                              &lt;h:panelGroup id="dates" rendered="#{searchBean.dateRated}"&gt;
                              &lt;h:outputText  value="test"&gt;&lt;/h:outputText&gt;
                              &lt;/h:panelGroup&gt;
                          &lt;/p:column&gt;
                      &lt;/p:row&gt;
                  &lt;/p:panelGrid&gt;
  &lt;/h:form&gt;
  </code></pre>
  
  <p>segment of the bean:</p>
  
  <pre><code>boolean dateRated;
  int dateWeight;
  
  public void addDatetoWeights(){
          dateRated=true;
          weights.put("date",dateWeight);
          System.out.println(dateRated);
      }
  
  public void removeDatefromWeights(){
          dateRated=false;
          if(weights.containsKey("date"))
              weights.remove("date");
      }
  </code></pre>