天天看點

Displaytag

<?xml version="1.0" encoding="GBK"?> 
<!DOCTYPE taglib PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.2//EN" 
"http://java.sun.com/dtd/web-jsptaglibrary_1_2.dtd"> 
<taglib> 
<tlib-version>1.1</tlib-version> 
<jsp-version>1.2</jsp-version> 
<short-name>display</short-name> 
<uri>http://displaytag.sf.net</uri> 
<display-name>Display *: Tag Library</display-name> 
<description> 
The display tag library is an open source suite of custom tags that provide high level web presentation patterns 
which will work in a MVC model, and provide a significant amount of functionality while still being simple and 
straight-forward to use. The primary tag in the library is the Table tag. 
</description> 
<tag> 
<name>table</name> 
<tag-class>org.displaytag.tags.TableTag</tag-class> 
<tei-class>org.displaytag.tags.TableTagExtraInfo</tei-class> 
<body-content>JSP</body-content> 
<display-name>table</display-name> 
<description> 
在jsp中顯示出一個表格,此表格可以通過定義屬性來獲得資料庫中的表,可以分頁排序的顯示出來,還可以将表中的資料以 
CSV,Excel,和XML的格式生成。 
</description> 
<attribute> 
<name>list</name> 
<required>false</required> 
<rtexprvalue>true</rtexprvalue> 
<description> 
參考表格中使用的源對象,可以表示一個請求對象範圍的特性,你必須定義一個name屬性或list屬性,使用Name來暗示。 
</description> 
</attribute> 
<attribute> 
<name>name</name> 
<required>false</required> 
<rtexprvalue>true</rtexprvalue> 
<description> 
指定範圍屬性的名稱,在标準标簽庫中必須有一個name标簽來指向源對象 
(request.setAttribute("test", (java.util.List) sqldb.getData()) //@*name="test"), 
sqldb.getData()是在資料庫中取出的所有記錄 
</description> 
</attribute> 
<attribute> 
<name>length</name> 
<required>false</required> 
<rtexprvalue>true</rtexprvalue> 
<type>int</type> 
<description> 
設定顯示在表格中的記錄數(//@*length="5") 
</description> 
</attribute> 
<attribute> 
<name>offset</name> 
<required>false</required> 
<rtexprvalue>true</rtexprvalue> 
<type>int</type> 
<description> 
設定從使用者輸入的索引值,顯示索引值後的所有記錄(//@*offset="3") 
</description> 
</attribute> 
<attribute> 
<name>pagesize</name> 
<required>false</required> 
<rtexprvalue>true</rtexprvalue> 
<type>int</type> 
<description> 
使用者輸入表格每頁顯示的記錄數,使表中的紀錄分頁顯示((//@*pagesize="6") 
</description> 
</attribute> 
<attribute> 
<name>decorator</name> 
<required>false</required> 
<rtexprvalue>true</rtexprvalue> 
<type>java.lang.String</type> 
<description> 
使用裝飾模式轉換資料顯示,使用者可以自己寫decorator。 
</description> 
</attribute> 
<attribute> 
<name>requestURI</name> 
<required>false</required> 
<rtexprvalue>true</rtexprvalue> 
<type>java.lang.String</type> 
<description> 
在struts中,當設定了排序後,點選表頭,它會指向你轉向的jsp,如果想跳轉到servlet,action,或者其他頁面, 
可以通過requestURI設定跳轉位址。 
</description> 
</attribute> 
<attribute> 
<name>style</name> 
<required>false</required> 
<rtexprvalue>true</rtexprvalue> 
<type>java.lang.String</type> 
<description>HTML通用屬性。</description> 
</attribute> 
<attribute> 
<name>class</name> 
<required>false</required> 
<rtexprvalue>true</rtexprvalue> 
<type>java.lang.String</type> 
<description> 
為表格定義樣式.這裡有五種樣式:isis,its,mars,simple,report,mark,但要引入screen.css樣式表. 
</description> 
</attribute> 
<attribute> 
<name>cellspacing</name> 
<required>false</required> 
<rtexprvalue>true</rtexprvalue> 
<type>java.lang.String</type> 
<description>HTML通用屬性,表格中單元格的邊距</description> 
</attribute> 
<attribute> 
<name>cellpadding</name> 
<required>false</required> 
<rtexprvalue>true</rtexprvalue> 
<type>java.lang.String</type> 
<description>HTML通用屬性,設定單元格沿四邊的大小寬度,比在style或class中使用"padding"更好.</description> 
</attribute> 
<attribute> 
<name>frame</name> 
<required>false</required> 
<rtexprvalue>true</rtexprvalue> 
<type>java.lang.String</type> 
<description>HTML通用屬性.</description> 
</attribute> 
<attribute> 
<name>rules</name> 
<required>false</required> 
<rtexprvalue>true</rtexprvalue> 
<type>java.lang.String</type> 
<description>HTML通用屬性.</description> 
</attribute> 
<attribute> 
<name>summary</name> 
<required>false</required> 
<rtexprvalue>true</rtexprvalue> 
<type>java.lang.String</type> 
<description>HTML通用屬性</description> 
</attribute> 
<attribute> 
<name>htmlId</name> 
<required>false</required> 
<rtexprvalue>true</rtexprvalue> 
<type>java.lang.String</type> 
<description>html中"id"通用屬性 </description> 
</attribute> 
<attribute> 
<name>export</name> 
<required>false</required> 
<rtexprvalue>true</rtexprvalue> 
<type>boolean</type> 
<description> 
設定能否導出:Excel,XML,CSV檔案,為true時可以導出. (//@*export="true") 
</description> 
</attribute> 
<attribute> 
<name>id</name> 
<required>false</required> 
<rtexprvalue>true</rtexprvalue> 
<type>java.lang.String</type> 
<description> 
添加id屬性,同時就在pageContext裡建立了一個隐含對象,指向list裡的目前對象可以通過 
(ListObject)pageContext.getAttribute("id")來捕獲這個對象。同時還建立了一個id_rowNum對象,同樣,可 
通過pageContext.getAttribute("testit_rowNum")來捕獲,它僅僅代表目前行的行數。 
</description> 
</attribute> 
<attribute> 
<name>sort</name> 
<required>false</required> 
<rtexprvalue>true</rtexprvalue> 
<type>java.lang.String</type> 
<description> 
輸入'list'并在列屬性中sortable為true的情況下,則按照表中所有記錄進行排序(//@*sort="list"). 
</description> 
</attribute> 
<attribute> 
<name>defaultsort</name> 
<required>false</required> 
<rtexprvalue>true</rtexprvalue> 
<type>int</type> 
<description> 
按照索引列的序号進行排序(//@*defaultsort="1"表示第一列). 
</description> 
</attribute> 
<attribute> 
<name>defaultorder</name> 
<required>false</required> 
<rtexprvalue>true</rtexprvalue> 
<type>java.lang.String</type> 
<description> 
對指定索引列的序号(defaultsort屬性)進行"升序(ascending)"(預設)或"降序(descending)",(//@*defaultorder="descending")。 
</description> 
</attribute> 
<attribute> 
<name>partialList</name> 
<required>false</required> 
<rtexprvalue>true</rtexprvalue> 
<type>boolean</type> 
<description>能否顯示集合的一部分,有效的值是true或false(//@*partialList="true")</description> 
</attribute> 
<attribute> 
<name>size</name> 
<required>false</required> 
<rtexprvalue>true</rtexprvalue> 
<description> 
當partialList為true時才能使用,是寫入一個整型對象,它是包含總資料集大小的,要用方法給整數賦予屬性 
(request.setAttribute("sum",new Integer(count))),count是資料庫中所有記錄總數,sum是屬性名,在size屬性中 
這樣寫://@*size="sum". 
</description> 
</attribute> 
<example> 
<![CDATA[ 
<display:table name="someList" export="true" id="row" requestURI="MyAction.do"> 
<display:column sortable="true" title="ID"> <c:out value="${row.id}"/> </display:column> 
<display:column property="email" autolink="true"/> 
<display:column property="description" title="Comments"/> 
</display:table> 
]]> 
</example> 
</tag> 
<tag> 
<name>column</name> 
<tag-class>org.displaytag.tags.ColumnTag</tag-class> 
<body-content>JSP</body-content> 
<display-name>column</display-name> 
<description> 
在表格内顯示一個烈的屬性,必須在table标簽内;其屬性名決定決定顯示列的内容, 
如果屬性為空,則在jsp頁面中沒有顯示。 
</description> 
<attribute> 
<name>property</name> 
<required>false</required> 
<rtexprvalue>true</rtexprvalue> 
<type>java.lang.String</type> 
<description> 
此屬性名是用來顯示列中記錄的,屬性名是pojo類(bean類)中的屬性。 
(//@*property="job_id" job_id是pojo類中的一個屬性) 
</description> 
</attribute> 
<attribute> 
<name>title</name> 
<required>false</required> 
<rtexprvalue>true</rtexprvalue> 
<type>java.lang.String</type> 
<description>列中的标題,列頭(//@*title="名稱")</description> 
</attribute> 
<attribute> 
<name>comparator</name> 
<required>false</required> 
<rtexprvalue>true</rtexprvalue> 
<description> 
The classname of comparator to use when sorting this column, or the comparator itself. Defaults to the 
DefaultComparator. 
</description> 
</attribute> 
<attribute> 
<name>total</name> 
<required>false</required> 
<rtexprvalue>true</rtexprvalue> 
<type>boolean</type> 
<description> 
在table标簽中添加 decorator="org.displaytag.decorator.TotalTableDecorator", 
然後在想要進行合計的資料列的 column标簽中添加 //@*total="true",該列就可以被計算總數了。 
</description> 
</attribute> 
<attribute> 
<name>sortable</name> 
<required>false</required> 
<rtexprvalue>true</rtexprvalue> 
<type>boolean</type> 
<description>此屬性如果設定為真那麼此列可以排序預設為假(//@*sortable="true").</description> 
</attribute> 
<attribute> 
<name>defaultorder</name> 
<required>false</required> 
<rtexprvalue>true</rtexprvalue> 
<type>java.lang.String</type> 
<description> 
預設為此列排序,有效值為升序(預設)和降序(//@*defaultorder="ascending" 或 //@*defaultorder="descending") 
</description> 
</attribute> 
<attribute> 
<name>autolink</name> 
<required>false</required> 
<rtexprvalue>true</rtexprvalue> 
<type>boolean</type> 
<description> 
如果要顯示的對象裡包含email和url位址,則可以在display:column裡直接設定autolink="true"來直接連接配接,預設為false. 
</description> 
</attribute> 
<attribute> 
<name>format</name> 
<required>false</required> 
<rtexprvalue>true</rtexprvalue> 
<type>java.lang.String</type> 
<description> 
可以使用标簽的方式格式化時間、數字、字元串。比如日期,在需要格式化的column标簽中添加 
//@*format="{0,date,yyyy-MM-dd}",第一個參數為格式化的資料序号, 
第二個參數是資料類型,數字為number,第三個參數為資料格式。 
</description> 
</attribute> 
<attribute> 
<name>href</name> 
<required>false</required> 
<rtexprvalue>true</rtexprvalue> 
<type>java.lang.String</type> 
<description> 
建立動态連接配接,基本的URL位址,等價于HTML中的href但不能傳參。 
</description> 
</attribute> 
<attribute> 
<name>url</name> 
<required>false</required> 
<rtexprvalue>true</rtexprvalue> 
<type>java.lang.String</type> 
<description> 
基于url的動态連結,等同于HTML中的href(//@*url="index.jsp"). 
</description> 
</attribute> 
<attribute> 
<name>paramId</name> 
<required>false</required> 
<rtexprvalue>true</rtexprvalue> 
<type>java.lang.String</type> 
<description> 
加在href屬性的URL位址後的參數名稱(//@*paramId="id" 等同于HTML中的 a href="index.jsp?id" target="_blank" rel="external nofollow" 的id參數)。 
</description> 
</attribute> 
<attribute> 
<name>paramName</name> 
<required>false</required> 
<rtexprvalue>true</rtexprvalue> 
<type>java.lang.String</type> 
<description> 
加在href屬性的URL位址後的參數值(//@*paramName="name" 等同于HTML中的 a href="index.jsp?id=name" target="_blank" rel="external nofollow"  id對應的name值)。 
</description> 
</attribute> 
<attribute> 
<name>paramProperty</name> 
<required>false</required> 
<rtexprvalue>true</rtexprvalue> 
<type>java.lang.String</type> 
<description> 
資料bean的屬性名稱,用來填充href屬性的URL位址後的參數值(//@*paramProperty="job_id" job_id是pojo類中的屬性) 
display:column href="baseurl" target="_blank" rel="external nofollow"  target="_blank" rel="external nofollow"  paramId="paramid" paramProperty="propertyname" 
http://baseurl/paramid=名字為propertyname的屬性值。 
</description> 
</attribute> 
<attribute> 
<name>paramScope</name> 
<required>false</required> 
<rtexprvalue>true</rtexprvalue> 
<type>java.lang.String</type> 
<description> 
設定paramid後邊的的名稱,此名稱為範圍内的名字為paramName的值, 
(display:column href="baseurl" target="_blank" rel="external nofollow"  target="_blank" rel="external nofollow"  paramId="paramid" paramName="name" paramScope="scope" 
寫成HTML是:http://baseurl/paramid=scope) 
</description> 
</attribute> 
<attribute> 
<name>maxLength</name> 
<required>false</required> 
<rtexprvalue>true</rtexprvalue> 
<type>int</type> 
<description> 
如果此屬性存在,那麼列的字元僅被顯示使用者定義的字元數, 
然後加上。。。(//@*maxLength="10" 如果在備注這列加上其屬性,那麼備注的字段隻顯示10個字元和。。。) 
當滑鼠劃過的時候顯示其全部内容 
</description> 
</attribute> 
<attribute> 
<name>maxWords</name> 
<required>false</required> 
<rtexprvalue>true</rtexprvalue> 
<type>int</type> 
<description> 
如果此屬性存在,那麼列僅被顯示使用者定義的單詞數,然後加上。。。 
(//@*maxWords="2" 如果在備注這列加上其屬性,那麼備注的字段隻顯示2個單詞加。。。) 
當滑鼠劃過的時候顯示其全部内容 
</description> 
</attribute> 
<attribute> 
<name>class</name> 
<required>false</required> 
<rtexprvalue>true</rtexprvalue> 
<type>java.lang.String</type> 
<description> 
HTML通用屬性,設定列的樣式。 
</description> 
</attribute> 
<attribute> 
<name>headerClass</name> 
<required>false</required> 
<rtexprvalue>true</rtexprvalue> 
<type>java.lang.String</type> 
<description>"class"html中的屬性僅能加在頭單元格内</description> 
</attribute> 
<attribute> 
<name>style</name> 
<required>false</required> 
<rtexprvalue>true</rtexprvalue> 
<type>java.lang.String</type> 
<description>HTML通用屬性,設定列的樣式。</description> 
</attribute> 
<attribute> 
<name>group</name> 
<required>false</required> 
<rtexprvalue>true</rtexprvalue> 
<type>int</type> 
<description> 
display:column property="city" title="CITY" group="1" 
display:column property="project" title="PROJECT" group="2" 
這樣不僅僅結果可以分組,而且還可以省略掉重複的資料,例如city列,project列都有 
A ,B ,A,B 兩行那麼第二行這兩列就不顯示了。 
同樣隻能對目前頁進行分組。 
注意:第一列一定要1,第二列一定是2,否則出NUllPoint 錯誤。 
</description> 
</attribute> 
</tag> 
</taglib>