0 Replies Latest reply on Oct 6, 2011 4:16 PM by aldosilva

    rich:select + a4j:ajax + backbutton browser

    aldosilva Newbie

      Hi everybory.


      I have a problem when the user click on the backbutton in the browser.


      I have a page with this code:


                <f:facet name="header">
                     <h:outputText value="Selecione o Usuário"></h:outputText>
                <rich:select value="#{selectUserAndPhase.itemUserValue}" defaultLabel="Selecione"  valueChangeListener="#                                          {selectUserAndPhase.valueChanged}" id="selectUserMenu" required="true" requiredMessage="obrigatório">
                          <f:selectItems value="#{selectUserAndPhase.listUser}" />
                          <a4j:ajax event="selectitem"  render="selectPhase" execute="@this" />
           <rich:message for="selectUserMenu" />
           <br />
           <a4j:outputPanel id="selectPhase" layout="block" >
                     <f:facet name="header">
                          <h:outputText value="Selecione a Fase"></h:outputText>
                      <rich:select value="#{selectUserAndPhase.itemPhaseValue}" defaultLabel="Selecione" id="selectPhaseMenu"                          required="true"   requiredMessage="obrigatório">
                           <f:selectItems value="#{selectUserAndPhase.listPhase}" />
                <rich:message for="selectPhaseMenu" />



      The problem occurs when the user goes to another page and return to this page through browser backbutton. The first rich:select doesn't reload

      the items and the outputPanel has already done the validation.


      Is there any way to reload the first rich:select when the user clicks on the backbutton?


      I implemented the PhaseListener but didn't solve my problem.


      public class NoBrowserCachePhaseListener implements PhaseListener{
          private static final long serialVersionUID = 1L;
          public void afterPhase(PhaseEvent event) {
                  // Do nothing special
          public void beforePhase(PhaseEvent event) {
                  FacesContext facesContext = event.getFacesContext();
                  HttpServletResponse response = (HttpServletResponse)facesContext.getExternalContext().getResponse();
                  response.addHeader("Pragma", "no-cache");
                  response.addHeader("Cache-Control", "no-cache");
                  response.addHeader("Cache-Control", "no-store");
                  response.addHeader("Cache-Control", "must-revalidate");
                  response.addHeader("Expires", "0");
          public PhaseId getPhaseId() {
                  return PhaseId.RENDER_RESPONSE;