나는 어떻게 매김하고이 테이블 Tomahawk
라이브러리없이 사용할 수 있습니다Tomahawk <t:saveState> 및 <t:dataList> 태그를 표준 JSF 태그로 바꾸는 방법은 무엇입니까?
<%@taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
<%@taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
<%@taglib uri="http://myfaces.apache.org/tomahawk" prefix="t"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<f:view>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Effective datatable paging and sorting at DAO level</title>
</head>
<body>
<h:form id="form">
<%-- The sortable datatable --%>
<h:dataTable value="#{myBean.dataList}" var="item">
<h:column>
<f:facet name="header">
<h:commandLink value="ID" actionListener="#{myBean.sort}">
<f:attribute name="sortField" value="id" />
</h:commandLink>
</f:facet>
<h:outputText value="#{item.id}" />
</h:column>
<h:column>
<f:facet name="header">
<h:commandLink value="Name" actionListener="#{myBean.sort}">
<f:attribute name="sortField" value="name" />
</h:commandLink>
</f:facet>
<h:outputText value="#{item.name}" />
</h:column>
<h:column>
<f:facet name="header">
<h:commandLink value="Value" actionListener="#{myBean.sort}">
<f:attribute name="sortField" value="value" />
</h:commandLink>
</f:facet>
<h:outputText value="#{item.value}" />
</h:column>
</h:dataTable>
<%-- The paging buttons --%>
<h:commandButton value="first" action="#{myBean.pageFirst}"
disabled="#{myBean.firstRow == 0}" />
<h:commandButton value="prev" action="#{myBean.pagePrevious}"
disabled="#{myBean.firstRow == 0}" />
<h:commandButton value="next" action="#{myBean.pageNext}"
disabled="#{myBean.firstRow + myBean.rowsPerPage >= myBean.totalRows}" />
<h:commandButton value="last" action="#{myBean.pageLast}"
disabled="#{myBean.firstRow + myBean.rowsPerPage >= myBean.totalRows}" />
<h:outputText value="Page #{myBean.currentPage}/#{myBean.totalPages}" />
<br />
<%-- The paging links --%>
<t:dataList value="#{myBean.pages}" var="page">
<h:commandLink value="#{page}" actionListener="#{myBean.page}"
rendered="#{page != myBean.currentPage}" />
<h:outputText value="<b>#{page}</b>" escape="false"
rendered="#{page == myBean.currentPage}" />
</t:dataList>
<br />
<%-- Set rows per page --%>
<h:outputLabel for="rowsPerPage" value="Rows per page" />
<h:inputText id="rowsPerPage" value="#{myBean.rowsPerPage}" size="3" maxlength="3" />
<h:commandButton value="Set" action="#{myBean.pageFirst}" />
<h:message for="rowsPerPage" errorStyle="color: red;" />
<%-- Cache bean with data list, paging and sorting variables for next request --%>
<t:saveState value="#{myBean}" />
</h:form>
</body>
</html>
</f:view>
분류와 JSF 테이블을 만드는 방법을 보여줍니다 this JSF 튜토리얼을 발견? 최대한 깨끗한 JSF를 사용하고 싶습니까? 페이징 및 정렬을 변경하지 않고 표준 JSF 태그만으로이 코드를 편집 할 수 있습니까?
가장 오래된 문서는 JSF의 1.x에서에 대상이되는 것을
좋아요. 나중에 @ViewScoped 만 사용하겠습니다. 나는 더 구체적 일 것이다. 어떻게이 코드 http://pastebin.com/ExLrdX3u를 h 라이브러리 태그로 대체 할 수 있는가? 최종 결과를 변경하지 않고 t 라이브러리 태그를 h 라이브러리로 대체하려고한다. –
오, 나는 ''을 놓쳤다. 나는 대답을 업데이트했다. –
BalusC