jsf自带分页

jsp页面:
<h:dataTable value="#{fw_logicSystemBB.list}" var="logicSys" id="data"
   border="1" bgcolor="#a9cef7" styleClass="sortable" cellpadding="5"
   rows="10">
   <h:column>
    <f:facet name="header">
     <h:outputText value="应用编号"></h:outputText>
    </f:facet>
    <h:outputText value="#{logicSys.appId}"></h:outputText>
   </h:column>
   <h:column>
    <f:facet name="header">
     <h:outputText value="系统名称"></h:outputText>
    </f:facet>
    <h:outputText value="#{logicSys.appName}"></h:outputText>
   </h:column>
<h:column>
    <f:facet name="header">
     <h:outputText value="操作"></h:outputText>
    </f:facet>
    <h:panelGroup style="align:center">
     <h:commandLink action="#{fw_logicSystemBB.updateLogicSytem}">
      <h:graphicImage url="../../images/action_modify.gif" />
      <x:updateActionListener value="#{logicSys.id}"
       property="#{fw_logicSystemBB.logicId}" />
     </h:commandLink>
     <h:commandLink action="#{fw_logicSystemBB.deleteById}"
      οnclick="javascript:if(!window.confirm('删除该逻辑的同时会删除其下面的所有其相关的所有资源,您确实要删除吗?删除点“确定”,返回点“取消”')) return false;">
      <h:graphicImage url="../../images/action_del.gif" />
      <x:updateActionListener value="#{logicSys.id}"
       property="#{fw_logicSystemBB.logicId}" />
     </h:commandLink>
    </h:panelGroup>
   </h:column>
  </h:dataTable>
<xmdc:panelGrid style="width:100%; text-align:center;">
   <h:panelGrid columns="2" columnClasses="standardTable_ColumnCentered">
    <x:dataScroller id="scroll_1" for="data" fastStep="10"
     rowsCountVar="rowsCount" pageCountVar="pageCount"
     pageIndexVar="pageIndex" paginatorMaxPages="9"
     paginatorTableClass="paginator"
     paginatorActiveColumnStyle="font-weighx:bold;"
     actionListener="#{fw_logicSystemBB.scrollerAction}">
     <xmdc:panelGrid align="left">
      <h:outputFormat value="总共{0}条记录" styleClass="standard">
       <f:param value="#{rowsCount}" />
      </h:outputFormat>
     </xmdc:panelGrid>
     <f:facet name="first">
      <x:outputLabel value="首页"></x:outputLabel>
     </f:facet>
     <f:facet name="previous">
      <x:outputLabel value="上一页"></x:outputLabel>
     </f:facet>
     <f:facet name="next">
      <x:outputLabel value="下一页"></x:outputLabel>
     </f:facet>
     <f:facet name="last">
      <x:outputLabel value="末页"></x:outputLabel>
     </f:facet>
    </x:dataScroller>
    <x:dataScroller id="scroll_2" for="data" rowsCountVar="rowsCount"
     displayedRowsCountVar="displayedRowsCountVar"
     firstRowIndexVar="firstRowIndex" lastRowIndexVar="lastRowIndex"
     pageCountVar="pageCount" pageIndexVar="pageIndex">
     <h:outputFormat value="页次:{3}/{4}页  {0}条/页   当前页从{1}到{2}条"
      styleClass="standard">
      <f:param value="#{displayedRowsCountVar}" />
      <f:param value="#{firstRowIndex}" />
      <f:param value="#{lastRowIndex}" />
      <f:param value="#{pageIndex}" />
      <f:param value="#{pageCount}" />
     </h:outputFormat>
    </x:dataScroller>
   </h:panelGrid>
  </xmdc:panelGrid>
注意两点:
1.<x:dataScroller id="scroll_1" for="data" 这里的"data"与相应的datatable的id相同(绑定相应的datatable)
2..<x:dataScroller id="scroll_1" for="data".........actionListener="#{fw_logicSystemBB.scrollerAction}">,绑定后台Bean的scrollerAction方法.
后台管理Bean---fw_logicSystemBB:
 /**
     * 分页标签的事件
     *
     * @param event
     */
    public void scrollerAction(ActionEvent event) {
        ScrollerActionEvent scrollerEvent = (ScrollerActionEvent) event;
        FacesContext.getCurrentInstance().getExternalContext().log(
                "scrollerAction: facet: " + scrollerEvent.getScrollerfacet() + ", pageindex: "
                        + scrollerEvent.getPageIndex());
    }
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值