2014-01-27 2 views
1

세 개의 dataTable이있는 JSF 페이지가 있습니다. 각각에는 연관된 dataScroller가 있습니다. 페이지를 볼 때 마지막 dataScroller (하단) 만 작동합니다. 다른 이들은 자신의 dataScroller에서 임의의 페이지를 선택할 때 마지막 dataTable에서 선택된 페이지 만로드합니다.dataScroller로 여러 데이터 테이블을 사용하면 각각 dataScroller 오작동이 발생합니다.

Firebug로 페이지를 디버깅했는데 아무런 관련이없는 것으로 나타났습니다. 이 문제를 해결하는 방법에 대해 여기 또는 다른 포럼에서 스레드를 찾지 못했습니다.

일부 코드를 게시해도 도움이 될 수 있습니다. 미리 감사드립니다 :

homepage.xhtml

<?xml version="1.0" encoding="ISO-8859-1" standalone="yes" ?> 
<html xmlns="http://www.w3.org/1999/xhtml" 
    xmlns:ui="http://java.sun.com/jsf/facelets" 
    xmlns:f="http://java.sun.com/jsf/core" 
    xmlns:h="http://java.sun.com/jsf/html" 
    xmlns:rich="http://richfaces.org/rich" 
    xmlns:c="http://java.sun.com/jstl/core"> 

<ui:composition template="layouts/template.jsf"> 
    <ui:define name="body"> 
     <h3>#{msg.homepageCaption1}</h3> 
     <h:form id="form"> 
      <div> 
       <rich:dataTable value="#{HomepageBean.firstTable}" 
        var="tOne" id="tableOne" rows="5"> 
        <rich:column> 
         <f:facet name="header"> 
          <h:outputText value="#{msg.firstColumn}" /> 
         </f:facet> 
         <h:outputText value="#{tOne.firstColumn}" /> 
        </rich:column> 
        <rich:column> 
         <f:facet name="header"> 
          <h:outputText value="#{msg.secondColumn}" /> 
         </f:facet> 
         <h:outputText value="#{tOne.secondColumn}" /> 
        </rich:column> 
        <rich:column> 
         <f:facet name="header"> 
          <h:outputText value="#{msg.thirdColumn}" /> 
         </f:facet> 
         <h:outputText value="This is an String" /> 
        </rich:column> 
        <rich:column> 
         <f:facet name="header"> 
          <h:outputText value="#{msg.fourthColumn}" /> 
         </f:facet> 
         <h:outputText value="#{tOne.fourthColumn}" /> 
        </rich:column> 
        <rich:column> 
         <f:facet name="header"> 
          <h:outputText value="#{msg.fifthColumn}" /> 
         </f:facet> 
         <h:outputText value="#{tOne.fifthColumn}" /> 
        </rich:column> 
       </rich:dataTable> 
       <rich:dataScroller for="tableOne" 
        pageIndexVar="#{HomepageBean.firstTablePage}" 
        ajaxSingle="false"> 
        <f:facet name="previous"> 
         <h:outputText value="&lt;" /> 
        </f:facet> 
        <f:facet name="next"> 
         <h:outputText value="&gt;" /> 
        </f:facet> 
        <f:facet name="fastrewind"> 
         <h:outputText value="&lt;&lt;" /> 
        </f:facet> 
        <f:facet name="fastforward"> 
         <h:outputText value="&gt;&gt;" /> 
        </f:facet> 
       </rich:dataScroller> 
      </div> 
      <div> 
       <h3>#{msg.homepageCaption2}</h3> 
       <rich:dataTable 
        value="#{HomepageBean.secondTable}" var="tTwo" 
        id="tableTwo" rows="5"> 
        <rich:column> 
         <f:facet name="header"> 
          <h:outputText value="#{msg.firstColumn}" /> 
         </f:facet> 
         <h:outputText value="#{tTwo.firstColumn}" /> 
        </rich:column> 
        <rich:column> 
         <f:facet name="header"> 
          <h:outputText value="#{msg.secondColumn}" /> 
         </f:facet> 
         <h:outputText value="#{tTwo.secondColumn}" /> 
        </rich:column> 
        <rich:column> 
         <f:facet name="header"> 
          <h:outputText value="#{msg.thirdColumn}" /> 
         </f:facet> 
         <h:outputText value="This is an string" /> 
        </rich:column> 
        <rich:column> 
         <f:facet name="header"> 
          <h:outputText value="#{msg.fourthColumn}" /> 
         </f:facet> 
         <h:outputText value="#{tTwo.fourthColumn}" /> 
        </rich:column> 
        <rich:column> 
         <f:facet name="header"> 
          <h:outputText value="#{msg.fifthColumn}" /> 
         </f:facet> 
         <h:outputText value="#{tTwo.fifthColumn}" /> 
        </rich:column> 
       </rich:dataTable> 
       <rich:dataScroller for="tableTwo" 
        pageIndexVar="#{HomepageBean.secondTablePage}" 
        ajaxSingle="false"> 
        <f:facet name="previous"> 
         <h:outputText value="&lt;" /> 
        </f:facet> 
        <f:facet name="next"> 
         <h:outputText value="&gt;" /> 
        </f:facet> 
        <f:facet name="fastrewind"> 
         <h:outputText value="&lt;&lt;" /> 
        </f:facet> 
        <f:facet name="fastforward"> 
         <h:outputText value="&gt;&gt;" /> 
        </f:facet> 
       </rich:dataScroller> 
      </div> 
      <div> 
       <h3>#{msg.homepageCaption3}</h3> 
       <rich:dataTable 
        value="#{homepageBean.thirdTable}" var="tThree" 
        id="tableThree" rows="5"> 
        <rich:column> 
         <f:facet name="header"> 
          <h:outputText value="#{msg.firstColumn}" /> 
         </f:facet> 
         <h:outputText value="#{tThree.firstColumn}" /> 
        </rich:column> 
        <rich:column> 
         <f:facet name="header"> 
          <h:outputText value="#{msg.secondColumn}" /> 
         </f:facet> 
         <h:outputText value="#{tThree.secondColumn}" /> 
        </rich:column> 
        <rich:column> 
         <f:facet name="header"> 
          <h:outputText value="#{msg.thirdColumn}" /> 
         </f:facet> 
         <h:outputText value="This is an string" /> 
        </rich:column> 
        <rich:column> 
         <f:facet name="header"> 
          <h:outputText value="#{msg.fourthColumn}" /> 
         </f:facet> 
         <h:outputText value="#{tThree.fourthColumn}" /> 
        </rich:column> 
        <rich:column> 
         <f:facet name="header"> 
          <h:outputText value="#{msg.fifthColumn}" /> 
         </f:facet> 
         <h:outputText value="#{tThree.fifthColumn}" /> 
        </rich:column> 
       </rich:dataTable> 
       <rich:dataScroller for="tableThree" 
        pageIndexVar="#{homepageBean.thirdTablePage}" 
        ajaxSingle="false"> 
        <f:facet name="previous"> 
         <h:outputText value="&lt;" /> 
        </f:facet> 
        <f:facet name="next"> 
         <h:outputText value="&gt;" /> 
        </f:facet> 
        <f:facet name="fastrewind"> 
         <h:outputText value="&lt;&lt;" /> 
        </f:facet> 
        <f:facet name="fastforward"> 
         <h:outputText value="&gt;&gt;" /> 
        </f:facet> 
       </rich:dataScroller> 
      </div> 
     </h:form> 
    </ui:define> 
</ui:composition> 
</html> 

homepageBean.java는

package somepackage.bean; 

import java.util.List; 

import org.springframework.beans.factory.annotation.Autowired; 
import org.springframework.context.annotation.Scope; 
import org.springframework.stereotype.Component; 

import somepackage.service.HomepageService; 
import somepackage.viewdto.ViewDTO; 

@Component("HomepageBean") 
@Scope("request") 
public class HomepageBean { 

    private List<ViewDTO> firstTable; 
    private List<ViewDTO> secondTable; 
    private List<ViewDTO> thirdTable; 
    private int firstTablePage; 
    private int secondTablePage; 
    private int thirdTablePage; 
    @Autowired 
    private HomepageService homepageService; 


    public List<ViewDTO> getFirstTable() { 
     return firstTable; 
    } 
    public void setFirstTable(List<ViewDTO> firstTable) { 
     this.firstTable = firstTable; 
    } 
    public List<ViewDTO> getSecondTable() { 
     return secondTable; 
    } 
    public void setSecondTable(List<ViewDTO> secondTable) { 
     this.secondTable = secondTable; 
    } 
    public List<ViewDTO> getThirdTable() { 
     return thirdTable; 
    } 
    public void setThirdTable(List<ViewDTO> thirdTable) { 
     this.thirdTable = thirdTable; 
    } 
    public int getFirstTablePage() { 
     return firstTablePage; 
    } 
    public void setFirstTablePage(int firstTablePage) { 
     this.firstTablePage = firstTablePage; 
    } 
    public int getSecondTablePage() { 
     return secondTablePage; 
    } 
    public void setSecondTablePage(int secondTablePage) { 
     this.secondTablePage = secondTablePage; 
    } 
    public int getThirdTablePage() { 
     return thirdTablePage; 
    } 
    public void setThirdTablePage(int thirdTablePage) { 
     this.thirdTablePage = thirdTablePage; 
    } 
    public HomepageService getHomepageService() { 
     return homepageService; 
    } 
    public void setHomepageService(HomepageService homepageService) { 
     this.homepageService = homepageService; 
    } 

} 
+0

DataScroller의 간단한 버전을 사용해보십시오 :''그리고 HomepageBean의 범위를 세션 –

+0

으로 변경하십시오. 이미 그것을 시도했습니다, Vasil. 그것은 작동하지 않았다. 어쨌든 귀하의 제안에 감사드립니다 :) – jplatasv

답변

2

이 문제는 (A panelGrid 내에서 각 테이블을 중첩 해결되었다 아무 생각이 없다 이것은을 수 있는지 여부 엄격하게 올바른 접근법이지만 효과가 있음) :

<?xml version="1.0" encoding="ISO-8859-1" standalone="yes" ?> 
<html xmlns="http://www.w3.org/1999/xhtml" 
    xmlns:ui="http://java.sun.com/jsf/facelets" 
    xmlns:f="http://java.sun.com/jsf/core" 
    xmlns:h="http://java.sun.com/jsf/html" 
    xmlns:rich="http://richfaces.org/rich" 
    xmlns:c="http://java.sun.com/jstl/core"> 

<ui:composition template="layouts/template.jsf"> 
    <ui:define name="body"> 
     <h3>#{msg.homepageCaption1}</h3> 
     <h:form id="form"> 
      <h:panelGrid columnClasses="acent"> 
       <rich:dataTable value="#{HomepageBean.firstTable}" 
        var="tOne" id="tableOne" rows="5"> 
        <rich:column> 
         <f:facet name="header"> 
          <h:outputText value="#{msg.firstColumn}" /> 
         </f:facet> 
         <h:outputText value="#{tOne.firstColumn}" /> 
        </rich:column> 
        <rich:column> 
         <f:facet name="header"> 
          <h:outputText value="#{msg.secondColumn}" /> 
         </f:facet> 
         <h:outputText value="#{tOne.secondColumn}" /> 
        </rich:column> 
        <rich:column> 
         <f:facet name="header"> 
          <h:outputText value="#{msg.thirdColumn}" /> 
         </f:facet> 
         <h:outputText value="This is an String" /> 
        </rich:column> 
        <rich:column> 
         <f:facet name="header"> 
          <h:outputText value="#{msg.fourthColumn}" /> 
         </f:facet> 
         <h:outputText value="#{tOne.fourthColumn}" /> 
        </rich:column> 
        <rich:column> 
         <f:facet name="header"> 
          <h:outputText value="#{msg.fifthColumn}" /> 
         </f:facet> 
         <h:outputText value="#{tOne.fifthColumn}" /> 
        </rich:column> 
       </rich:dataTable> 
       <rich:dataScroller for="tableOne" 
        pageIndexVar="#{HomepageBean.firstTablePage}" 
        ajaxSingle="false"> 
        <f:facet name="previous"> 
         <h:outputText value="&lt;" /> 
        </f:facet> 
        <f:facet name="next"> 
         <h:outputText value="&gt;" /> 
        </f:facet> 
        <f:facet name="fastrewind"> 
         <h:outputText value="&lt;&lt;" /> 
        </f:facet> 
        <f:facet name="fastforward"> 
         <h:outputText value="&gt;&gt;" /> 
        </f:facet> 
       </rich:dataScroller> 
      </h:panelGrid> 
      <h:panelGrid columnClasses="acent"> 
       <h3>#{msg.homepageCaption2}</h3> 
       <rich:dataTable 
        value="#{HomepageBean.secondTable}" var="tTwo" 
        id="tableTwo" rows="5"> 
        <rich:column> 
         <f:facet name="header"> 
          <h:outputText value="#{msg.firstColumn}" /> 
         </f:facet> 
         <h:outputText value="#{tTwo.firstColumn}" /> 
        </rich:column> 
        <rich:column> 
         <f:facet name="header"> 
          <h:outputText value="#{msg.secondColumn}" /> 
         </f:facet> 
         <h:outputText value="#{tTwo.secondColumn}" /> 
        </rich:column> 
        <rich:column> 
         <f:facet name="header"> 
          <h:outputText value="#{msg.thirdColumn}" /> 
         </f:facet> 
         <h:outputText value="This is an string" /> 
        </rich:column> 
        <rich:column> 
         <f:facet name="header"> 
          <h:outputText value="#{msg.fourthColumn}" /> 
         </f:facet> 
         <h:outputText value="#{tTwo.fourthColumn}" /> 
        </rich:column> 
        <rich:column> 
         <f:facet name="header"> 
          <h:outputText value="#{msg.fifthColumn}" /> 
         </f:facet> 
         <h:outputText value="#{tTwo.fifthColumn}" /> 
        </rich:column> 
       </rich:dataTable> 
       <rich:dataScroller for="tableTwo" 
        pageIndexVar="#{HomepageBean.secondTablePage}" 
        ajaxSingle="false"> 
        <f:facet name="previous"> 
         <h:outputText value="&lt;" /> 
        </f:facet> 
        <f:facet name="next"> 
         <h:outputText value="&gt;" /> 
        </f:facet> 
        <f:facet name="fastrewind"> 
         <h:outputText value="&lt;&lt;" /> 
        </f:facet> 
        <f:facet name="fastforward"> 
         <h:outputText value="&gt;&gt;" /> 
        </f:facet> 
       </rich:dataScroller> 
      </h:panelGrid> 
      <h:panelGrid columnClasses="acent"> 
       <h3>#{msg.homepageCaption3}</h3> 
       <rich:dataTable 
        value="#{homepageBean.thirdTable}" var="tThree" 
        id="tableThree" rows="5"> 
        <rich:column> 
         <f:facet name="header"> 
          <h:outputText value="#{msg.firstColumn}" /> 
         </f:facet> 
         <h:outputText value="#{tThree.firstColumn}" /> 
        </rich:column> 
        <rich:column> 
         <f:facet name="header"> 
          <h:outputText value="#{msg.secondColumn}" /> 
         </f:facet> 
         <h:outputText value="#{tThree.secondColumn}" /> 
        </rich:column> 
        <rich:column> 
         <f:facet name="header"> 
          <h:outputText value="#{msg.thirdColumn}" /> 
         </f:facet> 
         <h:outputText value="This is an string" /> 
        </rich:column> 
        <rich:column> 
         <f:facet name="header"> 
          <h:outputText value="#{msg.fourthColumn}" /> 
         </f:facet> 
         <h:outputText value="#{tThree.fourthColumn}" /> 
        </rich:column> 
        <rich:column> 
         <f:facet name="header"> 
          <h:outputText value="#{msg.fifthColumn}" /> 
         </f:facet> 
         <h:outputText value="#{tThree.fifthColumn}" /> 
        </rich:column> 
       </rich:dataTable> 
       <rich:dataScroller for="tableThree" 
        pageIndexVar="#{homepageBean.thirdTablePage}" 
        ajaxSingle="false"> 
        <f:facet name="previous"> 
         <h:outputText value="&lt;" /> 
        </f:facet> 
        <f:facet name="next"> 
         <h:outputText value="&gt;" /> 
        </f:facet> 
        <f:facet name="fastrewind"> 
         <h:outputText value="&lt;&lt;" /> 
        </f:facet> 
        <f:facet name="fastforward"> 
         <h:outputText value="&gt;&gt;" /> 
        </f:facet> 
       </rich:dataScroller> 
      </h:panelGrid> 
     </h:form> 
    </ui:define> 
</ui:composition> 
</html>