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());
}