0 Replies Latest reply on Mar 11, 2008 4:26 PM by Abhisek Jana

    FacesContext old value

    Abhisek Jana Newbie

      I am uploading an excel and generating the page with tabs and htmldatatable.The tabs are representing the number of sheets in the excel and htmldatatable in each tab is showing the data in grid.

      Every time i upload the file and the page get routed to the next page(where i have the dynamic tab and htmldatatable) and page displays correct data.But if i click on any tab its loading old data.

      In the jsp i am binding a richpanel with backend bean.

      <rich:panel id="mainpanel" id="mpDetailWorkspace" headerClass="rich-panel-header"
       style="z-index:1;" binding="#{fileUploadController.panel}">

      here is the parent child relationship -
      HtmlPanel -> HtmlTabPanel -> Tab -> HtmlDataTable

      after uploading the file i am calling loadFile() method and that method is creating the fileUploadController.panel object and routing the page to the jsp. First time it works fine, but if i click on a tab then page loads old data. Llike, if the 1st excel has 4 sheets and i am uploading another excel with 3 tabs then then -

      1. The page loads properly with 3 tabs (tabs == sheets)
      2. If I click on any tab then the page refresh and shows 4 tabs, but it should show only 3 tabs.
      All current 4 tabs are coming from previous data in FacesContext..
      but how??? and how to resolve that?

      I am not sure how the page loads the old data.
      here is the partial code of my back-end bean:
      Could any jsf master please let me know how to fix the issue and show only recent value not old value.

      public String loadFile() {
       panel = (HtmlPanel) findComponentInRoot("plnMainPanel");
       if (panel == null) {
       panel = new HtmlPanel();
       HtmlTabPanel tabPanel = new HtmlTabPanel();
       for (int j = 0; j < workbook.getNumberOfSheets(); j++) {
       HtmlTab tab = new HtmlTab();
       HtmlDataTable objHtmlDataTable=new HtmlDataTable();
       Application app = FacesContext.getCurrentInstance().getApplication();
       ValueBinding vb = app.createValueBinding("#{fileUploadController.alData["+j+"]}");
       for (int i = 1; i <= sheet.getLastRowNum(); ++i) {
       // populating the fileUploadController.alData["+j+"]
       HtmlColumn objHtmlColumn=new HtmlColumn();
       UIOutput objUIOutput=new UIOutput();
       objUIOutput.setValue("First Name");
       HtmlOutputText objHtmlOutputText=new HtmlOutputText();
       objHtmlOutputText.setValueBinding("value", FacesContext.getCurrentInstance().getApplication().createValueBinding("#{row.strFirstName}"));
       // setting other 5 columns