0 Replies Latest reply on May 21, 2008 2:40 PM by ultrapod

    strange problem with datascroller, calendar, and navigation

    ultrapod

      i'm having a strange problem where apparently the calendar control seems to be interfering with the expected behavior of the datascroller.

      i have a "master" datatable with an associated datascroller - the table has a link in each row that corresponds to a "detail" page for that given row. if you click the link, the application is supposed to navigate to that detail page.

      so the user starts by viewing the "master" datatable, and starts viewing on page 1 of those results. using the datascroller, the user then clicks to page 2 of the "master" datatable and decides to view the "detail" page for row 15, let's say, which is on a different jsp page. if the user then clicks the "back" button in the browser after viewing the detail page for row 15, one would expect that would return the user to the most recently viewed page of the "master" datatable, which would be page 2. the strange thing is that if there is a calendar control on the same page as the "master" datatable then this is *not8 the case - i'm seeing that the "master" datatable will display page 1, not page 2. (in general, the user always seems to get returned back to page 1, regardless of what datatable pages have been visited.)

      if i remove the calendar control from the "master" datatable page, clicking the "back" button displays the correct page of the "master" datatable, or at least it would be the page i would expect to see. so in the case above, after viewing the "detail" page for row 15, clicking the "back" button brings the user back to the "master" page, viewing page 2 of the datatable.

      here's my code:

      Testbed.jsp ("master" page, including calendar control):

      <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
      <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
      <%@ taglib uri="http://richfaces.org/a4j" prefix="a4j"%>
      <%@ taglib uri="http://richfaces.org/rich" prefix="rich"%>
      
      <f:view>
       <html>
       <body>
      
       <h:form id="testbed_form">
      
       <rich:calendar id="testbed_date"
       value="#{TestbedBean.testbedDate}"
       locale="US"
       popup="true"
       datePattern="MMM d, yyyy"
       showApplyButton="true"
       required="false"
       immediate="false">
       </rich:calendar>
      
       <rich:dataTable id = "testbed_table"
       rows = "10"
       rules="cols"
       rowClasses="oddRow, evenRow"
       value = "#{TestbedBean.testbedTableRows}"
       binding="#{TestbedBean.data}"
       var = "test_row">
      
       <rich:column>
       <f:facet name="header">
       <h:outputText value="Column 1"/>
       </f:facet>
       <h:commandLink action="#{TestbedBean.viewTestbed2}">
       <h:outputText value="#{test_row}"/>
       </h:commandLink>
       </rich:column>
      
       <f:facet name="footer">
       <rich:datascroller id="testbed_scroller"
       for="testbed_table"
       maxPages="10">
       </rich:datascroller>
       </f:facet>
      
       </rich:dataTable>
      
       </h:form>
      
       </body>
       </html>
      </f:view>
      
      



      Testbed2.jsp ("detail" page):

      <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
      <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
      <%@ taglib uri="http://richfaces.org/a4j" prefix="a4j"%>
      <%@ taglib uri="http://richfaces.org/rich" prefix="rich"%>
      
      <f:view>
       <html>
       <body>
      
       <h:form id="testbed2_form">
       <h:outputText value="Hello World"/>
       </h:form>
      
       </body>
       </html>
      </f:view>
      



      faces-config.xml

      <?xml version="1.0" encoding="UTF-8"?>
      <!DOCTYPE faces-config PUBLIC "-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.1//EN"
       "http://java.sun.com/dtd/web-facesconfig_1_1.dtd">
      
      <faces-config>
      
       <managed-bean>
       <managed-bean-name>TestbedBean</managed-bean-name>
       <managed-bean-class>
       com.jsf.test.TestbedBean
       </managed-bean-class>
       <managed-bean-scope>session</managed-bean-scope>
       </managed-bean>
      
      
       <navigation-rule>
       <from-view-id>/Testbed.jsp</from-view-id>
       <navigation-case>
       <from-action>
       #{TestbedBean.viewTestbed2}
       </from-action>
       <from-outcome>view</from-outcome>
       <to-view-id>/Testbed2.jsp</to-view-id>
       <redirect />
       </navigation-case>
       </navigation-rule>
      
      </faces-config>
      



      TestbedBean.java

      package com.jsf.test;
      
      import java.util.ArrayList;
      import java.util.Date;
      import java.util.List;
      
      import javax.faces.component.UIData;
      
      public class TestbedBean
      {
      
       private Date testbedDate;
       private UIData data = null;
      
       public List getTestbedTableRows()
       {
       return getTableRows(30);
       }
      
       private List getTableRows(int rows)
       {
       ArrayList<String> retval = new ArrayList<String>();
      
       for(int i=1; i<=rows; i++)
       {
       retval.add(Integer.toString(i));
       }
      
       return retval;
       }
      
       public String viewTestbed2()
       {
       return "view";
       }
      
       public Date getTestbedDate()
       {
       return testbedDate;
       }
      
       public void setTestbedDate(Date testbedDate)
       {
       this.testbedDate = testbedDate;
       }
      
      
       public UIData getData()
       {
       return data;
       }
      
      
       public void setData(UIData data)
       {
       this.data = data;
       }
      }
      



      i'm seeing the same problem with Firefox 2.x and IE7, so the issue does not seem to be browser related. i'm using JBoss 4.2.2, JSF RI 1.2_08, and RichFaces 3.2.0 SR1. hopefully this description makes some sense...