隨筆-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 簡易 閱讀(1721) 評論(0)  編輯  收藏

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


          網站導航:
           
          主站蜘蛛池模板: 甘洛县| 凤庆县| 焉耆| 广昌县| 平阴县| 绿春县| 海伦市| 吉水县| 大理市| 夏河县| 盖州市| 黎城县| 滦平县| 鄂尔多斯市| 司法| 山阳县| 余庆县| 江永县| 五河县| 迁西县| 稷山县| 墨竹工卡县| 怀化市| 三河市| 礼泉县| 玉环县| 留坝县| 葫芦岛市| 大厂| 新建县| 文山县| 棋牌| 明光市| 宁陵县| 大渡口区| 富蕴县| 农安县| 海宁市| 平邑县| 崇仁县| 苏尼特左旗|