title: How to overcome caching problem of jsf?
body: <p><strong>I have 7 drop down in my jsp(Using JSF tag-Select One Menu), 2 drop downs are dependent on other 2 drop downs. The scope of my Managed Bean is session.I have a single page and my result is a graph/table depending on the drop down menu selection. But my selection is getting cached and at times on refreshing the code my bean and my jsp page is not getting updated. Do I need to explicitly end the bean ssession? Please suggest me a solution.</strong></p>
  
  <p>My JSP page is as follows :</p>
  
  <p></p>
  
  <p>&lt;%@taglib uri="http://www.ibm.com/jsf/html_extended" prefix="hx"%>
  &lt;%@taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
  &lt;%@taglib uri="http://java.sun.com/jsf/html" prefix="h"%>&lt;%@taglib
  uri="http://www.ibm.com/jsf/BrowserFramework" prefix="odc"%>
  
  </p>
  
  
  
  <p>
  SLA DASHBOARD
  </p>
  
  <p>
      
      </p>
  
  <pre><code>&lt;div id="mDiv" class="pStyle"&gt;      
  &lt;h:form styleClass="form" id="LoginForm" &gt;&lt;br&gt;
      &lt;br&gt;
  &lt;div id="Header" class="hStyle"&gt;
          &lt;h:outputText value= "WELCOME TO SLA DASHBOARD" /&gt;
  &lt;/div&gt;
  &lt;br&gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
  &lt;div id="fDiv" &gt;
      &lt;fieldset class="fStyle"&gt;
          &lt;legend style="text-align: left;padding: 6px; font-weight:bold; font-size: 14"&gt;PLEASE MAKE YOUR SELECTION&lt;/legend&gt;&lt;br&gt;  
          &amp;nbsp;&amp;nbsp;
          &lt;h:outputText value="BU"/&gt;&amp;nbsp; 
          &lt;h:selectOneMenu id="slaBU" value="#{LoginForm.slaPeriod}"
              onchange="this.form.submit();" valueChangeListener="#{LoginForm.processBUChange}"&gt;
              &lt;f:selectItems value="#{LoginForm.buList}" /&gt;
          &lt;/h:selectOneMenu&gt;&amp;nbsp;&amp;nbsp; 
          &lt;h:outputText&gt;Application&lt;/h:outputText&gt;&amp;nbsp; 
          &lt;h:selectOneMenu id="slaApplication" style="width:160px" value="#{LoginForm.slaApp}" required="true"&gt;
              &lt;f:selectItems value="#{LoginForm.appList}" /&gt;
          &lt;/h:selectOneMenu&gt;&amp;nbsp;&amp;nbsp;
          &lt;h:outputText&gt;Period&lt;/h:outputText&gt;
          &lt;h:selectOneMenu id="slaPeriod" value="#{LoginForm.slaPeriod}" onchange="this.form.submit()"
              valueChangeListener="#{LoginForm.processPeriodChange}" &gt;
              &lt;f:selectItems value="#{LoginForm.periodList}"  /&gt;
          &lt;/h:selectOneMenu&gt;
          &amp;nbsp; 
          &lt;h:selectOneMenu id="slaPeriod1" style="width:100px"
              value="#{LoginForm.slaPeriod1}" required="true"&gt;
              &lt;f:selectItems value="#{LoginForm.periodList1}" /&gt;
          &lt;/h:selectOneMenu&gt;&amp;nbsp;
  
          &lt;h:selectOneMenu id="slaPeriod2" value="#{LoginForm.slaPeriod2}" required="true"&gt;
              &lt;f:selectItems value="#{LoginForm.periodList2}" /&gt;
          &lt;/h:selectOneMenu&gt;&amp;nbsp;&amp;nbsp; 
          &lt;h:outputText value="SLA Group" /&gt;
          &lt;h:selectOneMenu id="slaGroup" value="#{LoginForm.slaGroup}" required="true"&gt;
              &lt;f:selectItems value="#{LoginForm.groupList}" /&gt;
          &lt;/h:selectOneMenu&gt;&amp;nbsp;&amp;nbsp; 
  
          &lt;h:outputText&gt;View&lt;/h:outputText&gt;&amp;nbsp;
          &lt;h:selectOneMenu id="slaView" value="#{LoginForm.slaView}" required="true"&gt;
              &lt;f:selectItems value="#{LoginForm.viewList}" /&gt;
          &lt;/h:selectOneMenu&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp; 
          &lt;h:commandButton  id="submitButton" value="Submit"
               type="submit" onclick = "return validate();" 
               style="width:60px;" action="#{LoginForm.processSubmit}" 
               /&gt;
          &amp;nbsp; 
              &lt;br&gt;
              &lt;br&gt;
          &lt;/fieldset&gt;
      &lt;/div&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;
      &lt;div id="tDiv" &gt;
      &lt;h:dataTable id="bTable" value="#{LoginForm.BT}" var="BillingTable"
              style="font-weight: bold; text-align: center;" bgcolor="#D4D7FE"
              border="4" cellpadding="1" width="60%"
              rendered="#{LoginForm.btDisplay}"&gt;
  
              &lt;f:facet name="header"&gt;
                  &lt;h:outputText value="Billing Report" style="font-weight: bold"/&gt;
              &lt;/f:facet&gt;
  
              &lt;h:column&gt;
                  &lt;f:facet name="header"&gt;
                      &lt;h:outputText value="Buisness Unit" /&gt;
                  &lt;/f:facet&gt;
                  &lt;h:outputText value="#{BillingTable.buName}" /&gt;
              &lt;/h:column&gt;
  
              &lt;h:column&gt;
                  &lt;f:facet name="header"&gt;
                      &lt;h:outputText value="Completion Date" /&gt;
                  &lt;/f:facet&gt;
                  &lt;h:outputText value="#{BillingTable.completionDate}" /&gt;
              &lt;/h:column&gt;
  
              &lt;h:column&gt;
                  &lt;f:facet name="header"&gt;
                      &lt;h:outputText value="Target Date" /&gt;
                  &lt;/f:facet&gt;
                  &lt;h:outputText value="#{BillingTable.targetDate}"&gt;&lt;/h:outputText&gt;
              &lt;/h:column&gt;
              &lt;h:column&gt;
                  &lt;f:facet name="header"&gt;
                      &lt;h:outputText value="Billing Cycle" /&gt;
                  &lt;/f:facet&gt;
                  &lt;h:outputText value="#{BillingTable.billingCyle}"&gt;&lt;/h:outputText&gt;
              &lt;/h:column&gt;
              &lt;h:column&gt;
                  &lt;f:facet name="header"&gt;
                      &lt;h:outputText value="Status" /&gt;
                  &lt;/f:facet&gt;
                  &lt;h:outputText value="#{BillingTable.status}"&gt;&lt;/h:outputText&gt;
              &lt;/h:column&gt;
          &lt;/h:dataTable&gt;
          &lt;br&gt;
          &lt;h:dataTable id="uTable" value="#{LoginForm.UT}" var="UptimeTable"
              style="text-align: center"  bgcolor="#D4D7FE" 
              border="4" cellpadding="1" width="60%" rendered="#{LoginForm.utDisplay}"&gt;
  
              &lt;f:facet name="header"&gt;
                  &lt;h:outputText value="Uptime Report" style="font-style: normal; font-weight: bold"/&gt;
              &lt;/f:facet&gt;
  
              &lt;h:column&gt;
                  &lt;f:facet name="header"&gt;
                      &lt;h:outputText value="Application Name" style="width:60px" /&gt;
                  &lt;/f:facet&gt;
                  &lt;h:outputText value="#{UptimeTable.applicationName}" /&gt;
              &lt;/h:column&gt;
              &lt;h:column&gt;
                  &lt;f:facet name="header"&gt;
                      &lt;h:outputText value="Application Class" /&gt;
                  &lt;/f:facet&gt;
                  &lt;h:outputText value="#{UptimeTable.applicationClass}" /&gt;
              &lt;/h:column&gt;
  
              &lt;h:column&gt;
                  &lt;f:facet name="header"&gt;
                      &lt;h:outputText value="Availability-Actual" /&gt;
                  &lt;/f:facet&gt;
                  &lt;h:outputText value="#{UptimeTable.actual}" /&gt;
              &lt;/h:column&gt;
  
              &lt;h:column&gt;
                  &lt;f:facet name="header"&gt;
                      &lt;h:outputText value="Availability-Target" /&gt;
                  &lt;/f:facet&gt;
                  &lt;h:outputText value="#{UptimeTable.target}"&gt;&lt;/h:outputText&gt;
              &lt;/h:column&gt;
          &lt;/h:dataTable&gt;
          &lt;br&gt;
          &lt;h:dataTable id="tTable" value="#{LoginForm.TT}" var="TATTable"
              style="font-weight: bold; text-align: center" bgcolor="#D4D7FE"
              border="4" cellpadding="1" width="60%"
              rendered="#{LoginForm.ttDisplay}"&gt;
  
              &lt;f:facet name="header"&gt;
                  &lt;h:outputText value="Turn Around Time Report" /&gt;
              &lt;/f:facet&gt;
  
              &lt;h:column&gt;
                  &lt;f:facet name="header"&gt;
                      &lt;h:outputText value="Application Name" /&gt;
                  &lt;/f:facet&gt;
                  &lt;h:outputText value="#{TATTable.applicationName}" /&gt;
              &lt;/h:column&gt;
  
              &lt;h:column&gt;
                  &lt;f:facet name="header"&gt;
                      &lt;h:outputText value="Application Class" /&gt;
                  &lt;/f:facet&gt;
                  &lt;h:outputText value="#{TATTable.applicationClass}" /&gt;
              &lt;/h:column&gt;
  
              &lt;h:column&gt;
                  &lt;f:facet name="header"&gt;
                      &lt;h:outputText value="TAT Average" /&gt;
                  &lt;/f:facet&gt;
                  &lt;h:outputText value="#{TATTable.tatAverage}" /&gt;
              &lt;/h:column&gt;
  
              &lt;h:column&gt;
                  &lt;f:facet name="header"&gt;
                      &lt;h:outputText value="TAT Target" /&gt;
                  &lt;/f:facet&gt;
                  &lt;h:outputText value="#{TATTable.tatTarget}"&gt;&lt;/h:outputText&gt;
              &lt;/h:column&gt;
              &lt;h:column&gt;
                  &lt;f:facet name="header"&gt;
                      &lt;h:outputText value="Request Count" /&gt;
                  &lt;/f:facet&gt;
                  &lt;h:outputText value="#{TATTable.reqCount}"&gt;&lt;/h:outputText&gt;
              &lt;/h:column&gt;
              &lt;h:column&gt;
                  &lt;f:facet name="header"&gt;
                      &lt;h:outputText value="Request Type" /&gt;
                  &lt;/f:facet&gt;
                  &lt;h:outputText value="#{TATTable.reqType}"&gt;&lt;/h:outputText&gt;
              &lt;/h:column&gt;
          &lt;/h:dataTable&gt;
          &lt;/div&gt;
          &lt;br&gt;
          &lt;h:graphicImage styleClass="graphicImage" id="reportImage" alt="Sorry records not found !!"
              value="#{LoginForm.imageLocation}" width="700" height="250" rendered="#{LoginForm.viewImage}"&gt;
              &lt;/h:graphicImage&gt;&lt;br&gt;
          &lt;h3&gt;&lt;h:outputText value="Sorry records not found !!" rendered="#{LoginForm.notFoundMsg}"/&gt;&lt;/h3&gt; 
      &lt;/h:form&gt;
      &lt;/div&gt;
  &lt;/hx:scriptCollector&gt;&lt;/body&gt;
  </code></pre>
  
  <p>
  </p>
  
  <p><strong>Here is my LoginForm.java -- BackBean</strong></p>
  
  <p>package sla.dashboard.form;</p>
  
  <p>import sla.dashboard.Search.SearchManager;
  import sla.dashboard.drop_down_components.<em>;
  import sla.dashboard.datatables.</em>;
  import java.util.<em>;
  import javax.faces.context.FacesContext;
  import javax.faces.event.</em>;
  import javax.faces.model.*;</p>
  
  <p>public class LoginForm implements ValueChangeListener,ActionListener
  {</p>
  
  <pre><code>private String imageResult=null,imageLocation=null;
  private int slaPeriod,slaApp,slaBU,slaPeriod1,slaPeriod2,slaGroup,periodType,slaView;
  
  
  Boolean btDisplay,utDisplay,ttDisplay,viewImage,notFoundMsg;
  
  //Table Lists
  List &lt;BillingTable&gt; BT;
  List &lt;UptimeTable&gt; UT;
  List &lt;TATTable&gt; TT;
  
  DropDownComponents ddC;  
  
  List&lt;SelectItem&gt; buList;
  List&lt;SelectItem&gt; periodList;
  List&lt;SelectItem&gt; periodList1;
  List&lt;SelectItem&gt; periodList2;
  List&lt;SelectItem&gt; groupList;
  List&lt;SelectItem&gt; appList;
  
  List&lt;SelectItem&gt; viewList;
  
  ArrayList&lt;String&gt; result= new ArrayList&lt;String&gt;();
  
  
  public LoginForm()
  {
  
      ddC=new DropDownComponents(); 
      buList=ddC.getBuList();
      this.reset();
  
      BT=new ArrayList&lt;BillingTable&gt;(); 
      UT=new ArrayList&lt;UptimeTable&gt;();
      TT=new ArrayList&lt;TATTable&gt;();
  
      System.out.println("\n Back Bean Object Instantiated");
  }
  public int getSlaBU() {
      return slaBU;
  }
  
  public void setSlaBU(int slaBU) {
      this.slaBU = slaBU;
  }
  
  public int getSlaPeriod1() {
      return slaPeriod1;
  }
  
  public void setSlaPeriod1(int slaPeriod1) {
      this.slaPeriod1 = slaPeriod1;
  }
  
  public int getSlaPeriod2() {
      return slaPeriod2;
  }
  
  public void setSlaPeriod2(int slaPeriod2) {
      this.slaPeriod2 = slaPeriod2;
  }
  
  public int getSlaGroup() {
      return slaGroup;
  }
  
  public void setSlaGroup(int slaGroup) {
      this.slaGroup = slaGroup;
  }
  
  public int getPeriodType() {
      return periodType;
  }
  
  public void setPeriodType(int periodType) {
      this.periodType = periodType;
  }
  
  public int getSlaView() {
      return slaView;
  }
  
  public void setSlaView(int slaView) {
      this.slaView = slaView;
  }
  
  public ArrayList&lt;String&gt; getResult() {
      return result;
  }
  
  public void setResult(ArrayList&lt;String&gt; result) {
      this.result = result;
  }
  
  public int getSlaApp() {
      return slaApp;
  }
  
  public Boolean getBtDisplay() {
      return btDisplay;
  }
  
  public void setBtDisplay(Boolean btDisplay) {
      this.btDisplay = btDisplay;
  }
  
  public Boolean getUtDisplay() {
      return utDisplay;
  }
  
  public void setUtDisplay(Boolean utDisplay) {
      this.utDisplay = utDisplay;
  }
  
  public Boolean getTtDisplay() {
      return ttDisplay;
  }
  
  public void setTtDisplay(Boolean ttDisplay) {
      this.ttDisplay = ttDisplay;
  }
  
  public void setSlaApp(int slaApp) {
      this.slaApp = slaApp;
  }
  
  public int getSlaPeriod() {
      return slaPeriod;
  }
  
  public void setSlaPeriod(int slaPeriod) {
      this.slaPeriod = slaPeriod;
  }
  
  
  
  
  public List&lt;SelectItem&gt; getViewList() {
      return viewList;
  }
  
  public void setViewList(List&lt;SelectItem&gt; viewList) {
      this.viewList = viewList;
  }
  
  public List&lt;SelectItem&gt; getPeriodList() {
      return periodList;
  }
  public void setPeriodList(List&lt;SelectItem&gt; periodList) {
  
      this.periodList = periodList;
  }
  
  public List&lt;SelectItem&gt; getBuList() 
  {
      return buList;
  }
  
  
  
  public void setBuList(List&lt;SelectItem&gt; buList) {
      this.buList = buList;
  }
  
  
  public List&lt;SelectItem&gt; getPeriodList1() {
      return periodList1;
  }
  
  public void setPeriodList1(List&lt;SelectItem&gt; periodList1) {
      this.periodList1 = periodList1;
  }
  
  public List&lt;SelectItem&gt; getPeriodList2() {
      return periodList2;
  }
  
  public void setPeriodList2(List&lt;SelectItem&gt; periodList2) {
      this.periodList2 = periodList2;
  }
  
  public List&lt;SelectItem&gt; getGroupList() {
      return groupList;
  }
  
  public void setGroupList(List&lt;SelectItem&gt; groupList) {
      this.groupList = groupList;
  }
  
  public List&lt;SelectItem&gt; getAppList() {
      return appList;
  }
  
  public void setAppList(List&lt;SelectItem&gt; appList) {
      this.appList = appList;
  }
  
  
  
  
  //ValueChangeListener
  public void processValueChange(ValueChangeEvent arg0) throws AbortProcessingException 
  {}
  
  public void processPeriodChange(ValueChangeEvent arg0) throws AbortProcessingException 
  {
      this.setSlaPeriod(Integer.parseInt(arg0.getNewValue().toString()));
      this.setPeriodList1(ddC.getPeriodList1(Integer.parseInt(arg0.getNewValue().toString())));
  
      System.out.println("Period Changed Value : "+this.getSlaPeriod());
      FacesContext.getCurrentInstance().renderResponse();
  }
  
  public void processBUChange(ValueChangeEvent arg0) throws AbortProcessingException 
  {
      this.setSlaBU(Integer.parseInt(arg0.getNewValue().toString()));
      this.setAppList(ddC.getAppList(Integer.parseInt(arg0.getNewValue().toString())));
      System.out.println("\n BU Slected : " + this.getSlaBU());
      FacesContext.getCurrentInstance().renderResponse();
  }
  
  
  public void processAction(ActionEvent arg0) throws AbortProcessingException 
  {}
  public List&lt;BillingTable&gt; getBT() {
      return BT;
  }
  
  public void setBT(List&lt;BillingTable&gt; bt) {
      BT = bt;
  }
  
  public List&lt;UptimeTable&gt; getUT() {
      return UT;
  }
  
  public void setUT(List&lt;UptimeTable&gt; ut) {
      UT = ut;
  }
  
  public List&lt;TATTable&gt; getTT() {
      return TT;
  }
  
  public void setTT(List&lt;TATTable&gt; tt) {
      TT = tt;
  }
  
  
  public void setImageLocation(String imageLocation) {
      this.imageLocation = imageLocation;
  }
  
  public String getImageLocation() {
      return imageLocation;
  }
  
  public Boolean getViewImage() {
      return viewImage;
  }
  
  public void setViewImage(Boolean viewImage) {
      this.viewImage = viewImage;
  }
  
  public void setImageResult(String imageResult) {
      this.imageResult = imageResult;
  }
  
  public String getImageResult() {
      return imageResult;
  }
  
  public Boolean getNotFoundMsg() {
      return notFoundMsg;
  }
  
  public void setNotFoundMsg(Boolean notFoundMsg) {
      this.notFoundMsg = notFoundMsg;
  }
  
  public void reset()
  {
      slaPeriod=0;
      slaApp=0;
      slaBU=0;
      slaPeriod1=0;
      slaPeriod2=0;
      slaGroup=0;
      slaView=0;
      periodList=ddC.getPeriodList();
      periodList1=ddC.getPeriodList1(slaPeriod);
      periodList2=ddC.getPeriodList2();
      groupList=ddC.getSlaGroupList();
      appList=ddC.getAppList(slaApp);
      viewList=ddC.getViewList();
      this.setViewImage(false);
      this.setUtDisplay(false);
      this.setTtDisplay(false);
      this.setBtDisplay(false);
      this.setNotFoundMsg(false);
  
  }
  String getLabel(int index,List&lt;SelectItem&gt; lst)
  {
      return(lst.get(index).getLabel());
  }
  public String processSubmit()
  {
  
      System.out.println("Inside Process Submit "+this.getSlaBU()+
              this.getSlaApp()+this.getSlaPeriod()+this.getSlaPeriod1()+
              this.getSlaPeriod2()+this.getSlaGroup()+this.getSlaView());
      this.setViewImage(false);
      this.setUtDisplay(false);
      this.setTtDisplay(false);
      this.setBtDisplay(false);
      this.setNotFoundMsg(false);
  
      /*slaPeriod=1;
      slaApp=0;
      slaBU=1;
      slaPeriod1=1;
      slaPeriod2=2;
      slaGroup=2;
      slaView=1;*/
  
      if(this.slaGroup==1 &amp;&amp; slaView==1)
      { 
          BT=new SearchManager().searchBillingTable
  
              (slaBU,getLabel(slaPeriod,periodList),
              slaPeriod1,getLabel(slaPeriod2,
              periodList2),getLabel(slaGroup,groupList)); 
              if(BT.size()!=0)
                  this.setBtDisplay(true);
              else
                  this.setNotFoundMsg(true);
      }
      else
      {
          if(this.slaGroup==2 &amp;&amp; slaView==1)
          { 
                  UT=new SearchManager().searchUptimeTable
                  (slaBU,getLabel(slaPeriod,periodList),
                          slaPeriod1,getLabel(slaPeriod2,
                          periodList2),getLabel(slaGroup,groupList)); 
                  if(UT.size()!=0)
                      this.setUtDisplay(true);
                  else
                      this.setNotFoundMsg(true);
          }
          else
          {
              if(this.slaGroup==3 &amp;&amp; slaView==1)
              {
                  TT=new SearchManager().searchTATTable(slaBU,getLabel(slaPeriod,periodList),
                          slaPeriod1,getLabel(slaPeriod2,
                                  periodList2),getLabel(slaGroup,groupList)); 
                  if(TT.size()!=0)
                      this.setTtDisplay(true);
                  else
                      this.setNotFoundMsg(true);
  
              }
              else 
              {
                  if(slaView==2)
                  {
                      imageResult=new SearchManager().searchImage(slaBU,
                              getLabel(slaPeriod,periodList),
                      slaPeriod1,getLabel(slaPeriod2,periodList2),
                      getLabel(slaGroup,groupList),slaView);
                      this.setImageLocation(imageResult);
                      this.setViewImage(true);
                  }
                  else
                  {
                      this.setNotFoundMsg(true);
                  }
              }
          }
  }
      return("Success");
  }
  </code></pre>
  
  <p>}</p>
  
  <p><strong>My faces-config.xml</strong></p>
  
  <p>
      
          LoginForm
          sla.dashboard.form.LoginForm
          session
      
   </p>