隨筆-3  評論-0  文章-4  trackbacks-0

          號: 1.0

          ? ?? 能:表格處理

          參考文檔: displaytag.pdf

          包: displaytag.war

          ?

          簡要說明

          1.? 已知條件:

          1 )存在一個 JavaBean Computer(id mainboard cpu keyboard mouse buyTime)

          2 )存在一個 Collection( 包含五條 Computer 記錄 ) computer

          ?????? 3 request 存放該 Collection request.setAttribute(“test computer)

          ??????

          2.? Collection 里的記錄生成一張表

          代碼: <display table? name=”test”/>

          說明:該表中包含以 test 命名的 Collection 的五條記錄,顯示的列為該 Computer

          類的所有屬性。

          ?

          3.? 有選擇的顯示列

          代碼:

          <display table? name=”test” >

          ?????????????? <display column? property=”id” title=”ID” />

          ?????????????? <display column? property=”mainboard” />

          ?????????????? <display column? property=”cpu” />

          ?????????????? <display column? property=”buyTime” />

          ????? </display table>

          說明: property :代表要顯示的列,若不指定 title 則列名默認為 property 指定的屬性名。

          ???? 也可以增加其它自定義列,例如:

          <display:column title=" 操作 "> </display:column>

          ?

          4.? 指定以某列值進行排序

          代碼:

          <display table? name=”test” defaultsort="1" defaultorder="descending" >

          ?????????????? <display column? property=”id” title=”ID” ?sortable="true"/>

          ?????????????? <display column? property=”mainboard” />

          ?????????????? <display column? property=”cpu” />

          ?????????????? <display column? property=”buyTime” ?sortable="true"/>

          ????? </display table>

          ?

          說明: defaultsort 在還未點擊可排序列時的默認狀態

          ????? defaultorder :指明默認是升序還是降序進行排序( ascending /descending

          ????? sortable :在要進行排序的列上指明該屬性為 true ,則每點擊一次該列都會以升序或降序進行表格重排。

          ?

          5.? 創建動態連接

          代碼:

          <display table? name=”test” >

          ? ???<display column? property=”id” title=”ID” href=”details.jsp” paramId=”id” />

          ? ???<display column? property=”mainboard” ?href=”details.jsp” ?????????????????????????????????????????????? ?paramId=”action”? paramName=”testparam” />

          ? ???<display column? property=”cpu” ?href=”details.jsp” paramId=”id”

          paramScope =”request” paramProperty=”id”/>

          ? <display column? property=”buyTime”? />

          </display table>

          說明:

          href : the base URL used to construct the dynamic link

          paramId: the name of the parameter that gets added to the URL specified above

          paramName: name of the bean that contains the data we want to tack on the the URL

          (typically null, indicating the current object in the List)

          paramProperty: property to call on the object specified above to return the value that

          ?????????????????? ?? gets tacked onto the URL.

          paramScope: specific scope where the databean lives, typically null

          ?

          ?

          6.? 翻頁功能 ( 每頁顯示 2 條記錄 )

          <display table ?name=” test” pagesize ="2" />

          ?

          7.? 表頭、表尾說明

          表頭: <display caption>this is a table caption</display caption>

          ?

          表尾:

          <display:footer>

          ??? ?<tr>

          ????? ??<td colspan="3">sample footer</td>

          ????? ??<td>any sum or custom code can go here</td>

          ??? ?</tr>

          </display:footer>

          ?

          8.? 列表所處范圍

          pageScope

          requestScope ( 默認 ) ,前面所介紹的 test 都是從 request 中取出。

          sessionScope

          applicationScope

          例:從 sessionScope 中取出列表 test2

          ???????????????<display table name=” sessionScope.test2”/>
          posted on 2006-06-16 18:35 簡易 閱讀(1723) 評論(0)  編輯  收藏

          只有注冊用戶登錄后才能發表評論。


          網站導航:
           
          主站蜘蛛池模板: 繁峙县| 汉沽区| 大化| 东兴市| 光山县| 临泉县| 仁寿县| 时尚| 开远市| 望谟县| 龙江县| 安康市| 招远市| 万州区| 古蔺县| 德江县| 北流市| 璧山县| 淮滨县| 怀宁县| 奉化市| 鄂伦春自治旗| 英超| 丽江市| 湘潭市| 塘沽区| 小金县| 大连市| 文水县| 稻城县| 科技| 巴楚县| 宝清县| 隆安县| 井陉县| 霍邱县| 四川省| 西和县| 山西省| 莲花县| 泸溪县|