1)向表格中添加滚动条
<div style="overflow:auto:width=100%;height:200px;">
<h:dataTable.. >
<h:column...>
...
</h:column>
</h:dataTable>
</div>
2)加分页标签
1页面
<h:dataTable id="timezones" value="#{bb.data}" var="row" rows="10">
<h:column>
<h:selectBooleanCheckbox value="{bb.dummy}" onchange="submit()"/>
</h:column>
<h:column>
<h:outputText value="#{row}" />
</h:column>
</h:dataTable>
<corejsf:pager dataTableId="timezones" styleClass
="commonPage
"
showpages="10" selectedStyleClass
="currentPage
"/>
2.css
.currentPage
{
color: red;
background: yellow;
}
.commonPage
{
color: black;
}
3 render自定义
控制分页的样式
。
PagerRendere.java
Integer a = (Integer) component.getAttributes().get("showpages");
int showpages = (a == null ? 0 : a.intValue());
String styleClass
= (String) component.getAttributes().get("styleClass
");
String selectedStyleClass
= (String) component.getAttributes().get("selectedStyleClass
");
( i == currentPage )? selectedStyleClass : styleClass;
3 BackingBean
private String[] data = java.util.TimeZone.getAvailableIDs();
附件:csdn空间6/pager2.rar
(javax.el包在javaee.jar)
13.1.6 如何一次在一个页面中显示大型数据集
本文介绍如何在JSF项目中实现表格的滚动条效果及分页功能,并通过自定义样式来增强用户体验。

被折叠的 条评论
为什么被折叠?



