資料列表畫面程式

List.jsp

<%@page contentType="text/html"%>

<%@page pageEncoding="UTF-8"%>

<%@taglib uri="http://java.sun.com/jsf/core" prefix="f" %>

<%@taglib uri="http://java.sun.com/jsf/html" prefix="h" %>

<%

String formName = "通訊錄列表";

%>

<f:view>

<html>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />

<title><%=formName%></title>

<link rel="stylesheet" type="text/css" href="/JSF-Contact/faces/jsfcrud.css" />

</head>

<body>

<h:panelGroup id="messagePanel" layout="block">

<h:messages errorStyle="color: red" infoStyle="color: green" layout="table"/>

</h:panelGroup>

<h1><%=formName%></h1>

<h:form styleClass="jsfcrud_list_form">

<h:outputText escape="false" value="(無此資料)<br />" rendered="#{contact.pagingInfo.itemCount == 0}" />

<h:panelGroup rendered="#{contact.pagingInfo.itemCount > 0}">

<h:outputText value="#{contact.pagingInfo.firstItem + 1}..#{contact.pagingInfo.lastItem}/#{contact.pagingInfo.itemCount}"/>&nbsp;

<h:commandLink action="#{contact.prev}" value="前筆 #{contact.pagingInfo.batchSize}" rendered="#{contact.pagingInfo.firstItem >= contact.pagingInfo.batchSize}"/>&nbsp;

<h:commandLink action="#{contact.next}" value="次筆 #{contact.pagingInfo.batchSize}" rendered="#{contact.pagingInfo.lastItem + contact.pagingInfo.batchSize <= contact.pagingInfo.itemCount}"/>&nbsp;

<h:commandLink action="#{contact.next}" value="餘 #{contact.pagingInfo.itemCount - contact.pagingInfo.lastItem}"

rendered="#{contact.pagingInfo.lastItem < contact.pagingInfo.itemCount && contact.pagingInfo.lastItem + contact.pagingInfo.batchSize > contact.pagingInfo.itemCount}"/>

<h:dataTable value="#{contact.contactItems}" var="item" border="0" cellpadding="2" cellspacing="0" rowClasses="jsfcrud_odd_row,jsfcrud_even_row" rules="all" style="border:solid 1px">

<h:column>

<f:facet name="header">

<h:outputText value="MSN"/>

</f:facet>

<h:outputText value="#{item.msn}"/>

</h:column>

<h:column>

<f:facet name="header">

<h:outputText value="姓名"/>

</f:facet>

<h:outputText value="#{item.realName}"/>

</h:column>

<h:column>

<f:facet name="header">

<h:outputText value="電話"/>

</f:facet>

<h:outputText value="#{item.tel}"/>

</h:column>

<h:column>

<f:facet name="header">

<h:outputText escape="false" value="&nbsp;"/>

</f:facet>

<h:commandLink value="明細" action="#{contact.detailSetup}">

<f:param name="jsfcrud.currentContact" value="#{jsfcrud_class['com.emprogria.util.JsfUtil'].jsfcrud_method['getAsConvertedString'][item][contact.converter].jsfcrud_invoke}"/>

</h:commandLink>

<h:outputText value=" "/>

<h:commandLink value="修改" action="#{contact.editSetup}">

<f:param name="jsfcrud.currentContact" value="#{jsfcrud_class['com.emprogria.util.JsfUtil'].jsfcrud_method['getAsConvertedString'][item][contact.converter].jsfcrud_invoke}"/>

</h:commandLink>

<h:outputText value=" "/>

<h:commandLink value="刪除" action="#{contact.destroy}">

<f:param name="jsfcrud.currentContact" value="#{jsfcrud_class['com.emprogria.util.JsfUtil'].jsfcrud_method['getAsConvertedString'][item][contact.converter].jsfcrud_invoke}"/>

</h:commandLink>

</h:column>

</h:dataTable>

</h:panelGroup>

<br />

<h:commandLink action="#{contact.createSetup}" value="新增"/>

<br />

<br />

<h:commandLink value="回首頁" action="welcome" immediate="true" />

</h:form>

</body>

</html>

</f:view>