FaceLets自定义翻页组件

1)在web.xml文件中
<context-param>
<param-name>facelets.LIBRARIES</param-name>
<param-value>/WEB-INF/myTag.taglib.xml</param-value>
</context-param>

2)在WEB-INF目录下创建myTag.taglib.xml文件
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE facelet-taglib PUBLIC
  "-//Sun Microsystems, Inc.//DTD Facelet Taglib 1.0//EN"
  "http://java.sun.com/dtd/facelet-taglib_1_0.dtd">
<facelet-taglib>
<namespace>https://www.goldeninfo.net/myTag</namespace>
<tag>
    <tag-name>turnpage</tag-name>
    <source>../components/turnpage.xhtml</source>
</tag>
</facelet-taglib>

3)创建模版文件turnpage.xhtml
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:a4j="http://richfaces.org/a4j">
<div style="text-align: right;">
<a4j:outputPanel ajaxRendered="true">
          <a4j:commandLink action="#{list['first']}"   reRender="#{reRender}"
                        rendered="#{list['previousExists']}"
               value="#{messages.left}#{messages.left} #{messages.First}"
                  id="firstPage" >               
          </a4j:commandLink> 
          #{' '} #{' '}   
          <a4j:commandLink action="#{list['previous']}"   reRender="#{reRender}"
                        rendered="#{list['previousExists']}"
               value="#{messages.left} #{messages.Previous}"
                  id="previousPage"/>
          #{' '}#{' '}  
        <a4j:commandLink action="#{list['next']}"  reRender="#{reRender}"
                         rendered="#{list['nextExists']}"
               value="#{messages.Next}#{messages.right}"
                  id="nextPage"/>    
       #{' '}#{' '}
          <a4j:commandLink action="#{list['last']}" reRender="#{reRender}"
                        rendered="#{list['nextExists']}"
               value="#{messages.Last} #{messages.right}#{messages.right}"
                  id="lastPage"/>   
      
    &#160;&#160;&#160;
<h:outputFormat value="#{messages.system_fy}">
     <f:param value ="#{list['resultCount']}"/>
     <f:param value ="#{list['pageCount']}"/>
     <f:param value ="#{list['firstResult']/list['maxResults']+1}"/>
     <f:convertNumber integerOnly="true"/>
</h:outputFormat>
    </a4j:outputPanel>
    </div>
</ui:composition>

4)页面使用文件
1.自定义标签库xmlns:mt="https://www.goldeninfo.net/myTag"
2.使用<mt:turnpage list="#{pssDnsyList}" reRender="pssDnsyList"/>

你可能感兴趣的:(xml,Web,.net,XHTML,sun)