You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by 张伯通 <zh...@163.com> on 2009/03/23 09:54:34 UTC

Why the method run more than one times?


I've use the datatable target and commandlink to impl a page table. 
 
But the method showPrevious and showNext will run more than one times?I cann't find the problem.
 
I've used MyFaces core1.1.
 
 
CODE:
 
  <h:dataTable id="userTable2" rows="5" value="#{tableBean.users}" var="user">
      <f:facet name="spacer">
            <f:verbatim>&amp;#160;</f:verbatim>
      </f:facet>
      <h:column>
       <f:facet name="header">
     <h:outputText value="First Name"/>
    </f:facet>
    <h:outputText value="#{user.firstName}"/>
      </h:column>
      <h:column>
       <f:facet name="header">
     <h:outputText value="Last Name"/>
    </f:facet>
          <h:outputText value="#{user.lastName}"/>
      </h:column>
     <f:facet name="footer">
      <h:panelGroup>
          <h:commandLink actionListener="#{tableBean.previous}" rendered="#{tableBean.showPrevious}"
      style="padding-right:5px">
    <h:outputText value="<<Previous"/>
   </h:commandLink>
   <h:commandLink actionListener="#{tableBean.next}" rendered="#{tableBean.showNext}">
    <h:outputText value="Next>>"/>
   </h:commandLink>
      </h:panelGroup>
     </f:facet>
  </h:dataTable>