日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

DisplayTag用法

發(fā)布時間:2023/12/14 编程问答 26 豆豆
生活随笔 收集整理的這篇文章主要介紹了 DisplayTag用法 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

displayTag用法

1) 下載displayTag:

??? 官網(wǎng) http://www.displaytag.org/1.2

2) 搭建:

????? 將displaytag-1.2.jar文件拷貝到WEB-INF/lib文件夾下(如果想將表格導(dǎo)出到EXCEL還要把displaytag-export-poi-1.2.jar也一起拷貝),并確保環(huán)境中包含以下組件:
??? commons-logging、commons-lang、commons-collections、commons-beanutils、log4j、itext (可選,df/rtf export)

??? 將images、img、css三個文件夾拷到項目的WebRoot下

3)使用:

?????? 導(dǎo)入標(biāo)簽庫<%@ taglib uri="http://displaytag.sf.net" prefix="display" %> 或 <%@ taglib? uri="http://displaytag.sf.net/el" prefix="display-el" %>(支持EL表達(dá)式)

? 1.<display:table>表格標(biāo)簽

name:數(shù)據(jù)源,是一個List,例如:name="sessionScope.MyList" 數(shù)據(jù)取得范圍pageScope、requestScope (默認(rèn))、sessionScope、applicationScope requestURI:數(shù)據(jù)請求地址,例如:requestURI="MyAction.do" pagesize:每頁顯示的記錄數(shù)
length:要顯示的顯示記錄數(shù)
offset:從第幾條數(shù)據(jù)開始

??????? decorator:裝飾器,它要繼承TableDecorator類?

2.<display:caption>標(biāo)題

3.<display:column>列

??????? property:映射List中對象的屬性

??????? autolink:boolean,自動鏈接URL、email

???????? ?href(url):建立鏈接,也可以用decorator創(chuàng)建動態(tài)連接

paramId:加在URL 地址后的參數(shù)名稱   paramName:數(shù)據(jù)bean的名稱,一般為null(即使用當(dāng)前List里的對象)   paramScope:數(shù)據(jù)bean的范圍,一般為null   paramProperty:數(shù)據(jù)bean的屬性名稱,用來填充URL 地址后的參數(shù)值

value:靜態(tài)值

title:列名

sortable:column里的屬性對象要實現(xiàn)Comparable接口,如果沒有的話可以應(yīng)用decorator

decorator:裝飾器,它要繼承TableDecorator類

maxLength/maxWords:最大長度

???????? 備注:在<display:table/>里增加了id屬性,這時就在page context里創(chuàng)建了一個隱含對象,指向List里的當(dāng)前對象,可以通過? ?????????????????????(ListObject)pageContext.getAttribute("id")來捕獲這個對象。同時還創(chuàng)建了一個id_rowNum對象,

?????????????????? 可通過pageContext.getAttribute("表名_rowNum")來捕獲,它僅僅代表當(dāng)前行的行數(shù)。

4.<display:footer>表尾

5.<display:setProperty>設(shè)置屬性

例子:

<display:table name="someList" varTotals="totals" decorator="org.displaytag.sample.MyDecorator1">

<display:caption>This is the table caption</display:caption> <display:column property="id" title="ID" href="details.jsp" paramId="id"

decorator="org.displaytag.sample.MyDecorator2""/>
? <display:column property="itemName"
title="itemName">

<display:column property="price" total="true"group="1"href="details.jsp"

paramId="action" paramName="testparam" paramScope="request"/>

<display:footer>

<tr>

<td>Total Bill:</td>

<td><c:out value="${totals.column2}" /></td>

<tr>

</display:footer>

</display:table>


4)配置:

??? 缺省配置文件displaytag.properties在Library jar文件夾內(nèi),你可以在classpath下重寫一個配置文件? displaytag.properties也可以通過<display:setProperty>設(shè)置

5)其他:

如果出現(xiàn)錯誤可以在web.xml文件中設(shè)置過濾器 <filter><filter-name>ResponseOverrideFilter</filter-name><filter-class>org.displaytag.filter.ResponseOverrideFilter</filter-class></filter><filter-mapping><filter-name>ResponseOverrideFilter</filter-name><url-pattern>*.do</url-pattern></filter-mapping><filter-mapping><filter-name>ResponseOverrideFilter</filter-name><url-pattern>*.jsp</url-pattern></filter-mapping>

總結(jié)

以上是生活随笔為你收集整理的DisplayTag用法的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。