久久久久亚洲AV无码专区首JN ,4444亚洲国产成人精品,亚洲成人一级电影http://www.tkk7.com/fisher/category/29661.html天行健,君子以自強不息。地勢坤,君子以厚德載物。zh-cnWed, 21 May 2008 05:43:39 GMTWed, 21 May 2008 05:43:39 GMT60Struts2中的鏈接標(biāo)簽http://www.tkk7.com/fisher/articles/201782.htmlFisherFisherTue, 20 May 2008 14:58:00 GMThttp://www.tkk7.com/fisher/articles/201782.htmlhttp://www.tkk7.com/fisher/comments/201782.htmlhttp://www.tkk7.com/fisher/articles/201782.html#Feedback0http://www.tkk7.com/fisher/comments/commentRss/201782.htmlhttp://www.tkk7.com/fisher/services/trackbacks/201782.htmlStruts2中的鏈接標(biāo)簽
2007年11月29日 星期四 12:56
為了使從一個頁面中鏈接一個動態(tài)數(shù)據(jù)變得簡單,Struts2框架提供了一系列的標(biāo)簽。
Struts2標(biāo)簽的一種用法是創(chuàng)建鏈接到其他Web資源,特別是針對那些在本地應(yīng)用中的資源。
1.普通鏈接
Web程序中最普通的應(yīng)用是鏈接到其他頁面,下面看Welcome.jsp
<%@ page contentType="text/html; charset=UTF-8" %>
<%@ taglib prefix="s" uri="/struts-tags" %>
<html>
<head>
    <title>Welcome</title>
    <link href="<s:url value="/css/tutorial.css"/>" rel="stylesheet"
          type="text/css"/>
</head>
<body>
<h3>Commands</h3>
<ul>
    <li><a href="<s:url action="Login_input"/>">Sign On</a></li>
    <li><a href="<s:url action="Register"/>">Register</a></li>
</ul>
</body>
</html>
1.1說明
1<%@ taglib prefix="s" uri="/struts-tags" %>
此句表示導(dǎo)入struts標(biāo)簽,并以s為前綴。即以s為前綴的標(biāo)簽均來自struts標(biāo)簽庫。
2<link href="<s:url value="/css/tutorial.css"/>" rel="stylesheet" type="text/css"/>
此句表示利用url標(biāo)簽導(dǎo)入一個路徑,鏈接到一個文件,注意此路徑為項目下的絕對路徑。
3<a href="<s:url action="Login_input"/>">Sign On</a>
此句表示利用url標(biāo)簽鏈接到一個action
1.2注冊action
我們在struts.xml中注冊一個action來顯示welcome.jsp
<action name="Welcome">
       <result>/example/Welcome.jsp</result>
</action>
注意此action注冊在package example下,所以在地址欄中敲入http://localhost:8080/StrutsHelloWorld/example/Welcome.actionStrutsHelloWorldproject名),會導(dǎo)向到Welcome.jsp。
2.使用通配符
對于上面的action注冊,我們也可以用下面的語句代替。
<action name="*">
       <result>/example/{1}.jsp</result>
</action>
此句的意思是,如果在沒有找到匹配的action名稱的情況下,默認(rèn)調(diào)用action名稱.jsp。第一句中星號指任意,而第二句中{1}指代第一句中星號指代的內(nèi)容。

    舉個例子,如果在地址欄中敲入
http://localhost:8080/StrutsHelloWorld/example/1.action,則系統(tǒng)查找struts.xml,發(fā)現(xiàn)沒有name1action,即最后調(diào)用name為星號的這個action,根據(jù)此action,將輸出/example/1.jsp
或者讀者可以直接點擊Welcome.jsp中的兩個超鏈接,系統(tǒng)將會報錯找不到Login_input.jspRegister.jsp。因為這兩個action還沒有注冊,也沒有相應(yīng)的jsp文件。
3.帶參數(shù)的鏈接
超鏈接后面帶有參數(shù)大家不會陌生,諸如http://www.apache.com/?language=ch。這個鏈接后面帶有一個language參數(shù),其值為ch。你可以通過request.getParameter(“language”)找到參數(shù)值。下面演示在struts2中如何設(shè)置帶參數(shù)的鏈接。看HelloWorld.jsp
<%@ taglib prefix="s" uri="/struts-tags"%>
<html>
<head>
<title>Hello World!</title>
</head>
<body>
<h2><s:property value="message" /></h2>
<h3>Languages</h3>
<ul>
       <li>
       <s:url id="url" action="HelloWorld">
              <s:param name="request_locale">en</s:param>
       </s:url>
       <s:a href="%{url}">English</s:a>
       </li>
       <li>
       <s:url id="url" action="HelloWorld">
              <s:param name="request_locale">es</s:param>
       </s:url>
       <s:a href="%{url}">Espanol</s:a>
       </li>
</ul>
</body>
</html>

3.1
說明
1<s:url id="url" action="HelloWorld">
              <s:param name="request_locale">en</s:param>
</s:url>
此段表示設(shè)置一個url標(biāo)簽指向名為HelloWorldaction,此標(biāo)簽帶一個id取名為url,后面會用到。帶一個參數(shù)request_locale,其值為en
2<s:a href="%{url}">English</s:a>
此句用到了struts2的超鏈接標(biāo)簽,連接的地址即為1url,點擊English,發(fā)出的信息為:http://localhost:8080/StrutsHelloWorld/example/HelloWorld.actionrequest_locale=en
3.2注冊actionstruts.xml
<struts>
       <package name="example" namespace="/example"
              extends="struts-default">
              <action name="HelloWorld" >
                     <result>/example/HelloWorld.jsp</result>
              </action>


Fisher 2008-05-20 22:58 發(fā)表評論
]]>
DisplayTag1.1用法記錄 http://www.tkk7.com/fisher/articles/182311.htmlFisherFisherTue, 26 Feb 2008 14:06:00 GMThttp://www.tkk7.com/fisher/articles/182311.htmlhttp://www.tkk7.com/fisher/comments/182311.htmlhttp://www.tkk7.com/fisher/articles/182311.html#Feedback0http://www.tkk7.com/fisher/comments/commentRss/182311.htmlhttp://www.tkk7.com/fisher/services/trackbacks/182311.html

You can use any valid java.text.MessageFormat pattern in the format attribute. Sorting will be based on the original object, not on the formatted String.

Note that errors due to an invalid pattern/object combination (for example trying to format a String like a number) will not be rethrown. Instead, an error log will be written and the original unformatted object displayed.

You can also use a format pattern along with column decorators (the pattern will be applied after the decoration).

  <display:table name="test">
    
<display:column property="id" title="ID" />
    
<display:column property="email" format="email is {0}" />
    
<display:column property="date" format="{0,date,dd-MM-yyyy}" sortable="true"/>
    
<display:column property="money" format="{0,number,0,000.00} $" sortable="true"/>
  
</display:table>


Fisher 2008-02-26 22:06 發(fā)表評論
]]>
DisplayTag筆記(轉(zhuǎn))http://www.tkk7.com/fisher/articles/181550.htmlFisherFisherSat, 23 Feb 2008 01:08:00 GMThttp://www.tkk7.com/fisher/articles/181550.htmlhttp://www.tkk7.com/fisher/comments/181550.htmlhttp://www.tkk7.com/fisher/articles/181550.html#Feedback0http://www.tkk7.com/fisher/comments/commentRss/181550.htmlhttp://www.tkk7.com/fisher/services/trackbacks/181550.htmlDisplayTag筆記
本文介紹DisplayTag的一些使用方法。摘自[http://hongyu0809.spaces.msn.com/PersonalSpace.aspx]
DisplayTag 基本介紹
DisplayTag是一個非常好用的表格顯示標(biāo)簽,適合MVC模式,
其主頁在http://displaytag.sourceforge.net
在這里可以下載displaytag-1.0.jar
同時需要一下包文件:
jstl.jar
standard.jar
commons-lang-2.0.jar
commons-collections.jar
commons-beanutils.jar
crimson.jar
gnujaxp.jar
nekohtml.jar(org.cyberneko.html.parsers.DOMFragmentParser等)
xerces-2.4.0.jar(org.apache.html.dom.HTMLDocumentImpl等)
poi-2.5.1-final-20040804.jar
然后把對應(yīng)的jar文件copy到WEB-INF/lib中.
DisplayTag的使用:
<display:table id="pres" name="${pagedData.data}" sort="list"
styleClass="list" export="true"
requestURI="${request.contextPath}" pagesize="10" defaultsort="3">
name是要展現(xiàn)的集合數(shù)據(jù).
id:在<display:table/>里增加了id屬性,就在page context里創(chuàng)建了一個隱含對象,指向List里的當(dāng)前對象,
 所以可以通過(ListObject)pageContext.getAttribute("id")來捕獲這個對象。
 同時還創(chuàng)建了一個id_rowNum對象,
 可通過pageContext.getAttribute("testit_rowNum")來捕獲,它僅僅代表當(dāng)前行的行數(shù)。
sort     表示整個list被排序.
pagesize   表示每頁所要展示的數(shù).
defaultsort   表示默認(rèn)是按第幾列排序的,注意這里是以1開始計數(shù)的,默認(rèn)從第一列開始排序.
defaultorder    指定排序方式,defaultorder="descending" 指定默認(rèn)為降序
styleClass    指定所要應(yīng)用的樣式.
requestURI
<display:caption>使用displayTag示例</display:caption>
display:caption標(biāo)記中間的字符串是用來放到表格上面的標(biāo)題.
<display:column property="firstName" title="First Name" sortable="true" export="true"/>
display:column標(biāo)記指定了每列的屬性.
property   對應(yīng)List里對象的屬性(它是用getXXX()方法獲取)
title      對應(yīng)表格表頭里的列名
export="true"              導(dǎo)出文件時導(dǎo)出該列
sortable="true"            設(shè)定該列可進(jìn)行排序
分類樣板說明如下:
  
  一、最簡單的情況,未使用<display:column/>標(biāo)簽
  
  <%request.setAttribute( "test", new ReportList(6) );%>
  <display:table name="test" />
  
  標(biāo)簽遍歷List里的每一個對象,并將對象里的所有屬性顯示出來。一般用于開發(fā)的時候檢查對象數(shù)據(jù)的完整性。
  
  二、使用<display:column/>標(biāo)簽的情況
  
  <display:table name="test">
  <display:column property="id" title="ID" />
  <display:column property="name" />
  <display:column property="email" />
  <display:column property="status" />
  <display:column property="description" title="Comments"/>
  </display:table>
  
  property對應(yīng)List里對象的屬性(用getXXX()方法取得),title則對應(yīng)表格表頭里的列名。定義列有兩種方式:
  
  A、<display:column property="email" />
  
  使用<display:column/>標(biāo)簽里的property屬性來定義
  
  B、<display:column title="email">email@it.com</display:column>
  
  在<display:column/>標(biāo)簽體里增加內(nèi)容,可以是常量,也可以用其他標(biāo)簽等等
  
  兩種方式比較,用property屬性來定義更加快速和利于排序。
  
  三、表格顯示樣式的定義
  
  A、在<display:table/>和<display:column/>標(biāo)簽里指定標(biāo)準(zhǔn)的html屬性,煩瑣
  
  B、修改樣式表
  <display:table name="test" class="mars">
  <display:column property="id" title="ID" class="idcol"/>
  <display:column property="name" />
  <display:column property="email" />
  <display:column property="status" class="tableCellError" />
  <display:column property="description" title="Comments"/>
  </display:table>
  
  通過class屬性來指定所要應(yīng)用的樣式。
  
  四、標(biāo)簽取得數(shù)據(jù)的數(shù)據(jù)源
  
  有四種范圍
  
  pageScope
  requestScope (默認(rèn)) <display:table name="test2" >  相當(dāng)于request.getAttribute( "test2"))
  sessionScope <display:table name="sessionScope.holder.list" > 注意,這里要指定范圍,非默認(rèn)
  applicationScope
  
  五、通過增加id屬性創(chuàng)建隱含的對象
  
  <display:table name="test" id="testit">
  <display:column property="id" title="ID" />
  <display:column property="name" />
  <display:column title="static value">static</display:column>
  <display:column title="row number (testit_rowNum)">
     <%=pageContext.getAttribute("testit_rowNum")%>
    </display:column>
  <display:column title="((ListObject)testit).getMoney()">
     <%=((ListObject)pageContext.getAttribute("testit")).getMoney()%>
    </display:column>
  </display:table>
    在<display:table/>里增加了id屬性,就在page context里創(chuàng)建了一個隱含對象,
  可以通過(ListObject)pageContext.getAttribute("id")來捕獲這個對象。
    同時還創(chuàng)建了一個id_rowNum對象,同樣,
    可通過pageContext.getAttribute("testit_rowNum")來捕獲,它僅僅代表當(dāng)前行的行數(shù)。
  
  有了這兩個隱含對象,就可以通過其他標(biāo)簽來訪問,例如Jstl:
  
  <display:table id="row" name="mylist">
  <display:column title="row number" >
  <c:out value="${row_rowNum}"/>
  </display:column>
  <display:column title="name" >
  <c:out value="${row.first_name}"/>
  <c:out value="${row.last_name}"/>
  </display:column>
  </display:table>
  
  六、顯示部分?jǐn)?shù)據(jù)
  
  顯示開始五條數(shù)據(jù):通過設(shè)定length屬性
  
  <display:table name="test" length="5">
  <display:column property="id" title="ID" />
  <display:column property="email" />
  <display:column property="status" />
  </display:table>
  
  顯示第三到第八條數(shù)據(jù):通過設(shè)定offset和length屬性
  
  <display:table name="test" offset="3" length="5">
  <display:column property="id" title="ID" />
  <display:column property="email" />
  <display:column property="status" />
  </display:table>
  
  七、對email和url地址的直接連接
  
  <display:table name="test" >
  <display:column property="id" title="ID" />
  <display:column property="email" autolink="true" />
  <display:column property="url" autolink="true" />
  </display:table>
  
  如果要顯示的對象里包含email和url地址,則可以在display:column里直接設(shè)定autolink="true"來直接連接
  
  八、使用裝飾模式轉(zhuǎn)換數(shù)據(jù)顯示(寫自己的 decorator )
  
  A、對整個表格應(yīng)用decorator
  
  <display:table name="test" decorator="org.displaytag.sample.Wrapper" >
  <display:column property="id" title="ID" />
  <display:column property="email" />
  <display:column property="status" />
  <display:column property="date" />
  <display:column property="money" />
  </display:table>
  org.displaytag.sample.Wrapper即自己寫的decorator,它要繼承TableDecorator類,看看它的一個方法:
  public String getMoney()
  {
  return this.moneyFormat.format(((ListObject) this.getCurrentRowObject()).getMoney());
  }
  
  很明顯,它通過父類的getCurrentRowObject()方法獲得當(dāng)前對象,然后對其getMoney()方法進(jìn)行'油漆'
  
  B、對單獨的column應(yīng)用decorator
  
  <display:table name="test">
  <display:column property="id" title="ID" />
  <display:column property="email" />
  <display:column property="status" />
  <display:column property="date" decorator="org.displaytag.sample.LongDateWrapper" />
  </display:table>
  org.displaytag.sample.LongDateWrapper要實現(xiàn)ColumnDecorator接口,它的方法:
  public final String decorate(Object columnValue)
  {
  Date date = (Date) columnValue;
  return this.dateFormat.format(date);
  }
  
  顯然,它獲得不了當(dāng)前對象(因為它實現(xiàn)的是接口),僅僅是獲得該對象的columnValue,然后'油漆'
  
  九、創(chuàng)建動態(tài)連接
  
  有兩種方法創(chuàng)建動態(tài)連接:
  
  A、在<display:column/>里通過增加href、paramId、paramName、paramScope、paramProperty屬性
  
  href       基本的URL 地址
  paramId     加在URL 地址后的參數(shù)名稱
  paramName    數(shù)據(jù)bean的名稱,一般為null(即使用當(dāng)前List里的對象)
  paramScope    數(shù)據(jù)bean的范圍,一般為null
  paramProperty  數(shù)據(jù)bean的屬性名稱,用來填充URL 地址后的參數(shù)值
  <display:table name="sessionScope.details">
  <display:column property="id" title="ID" href="details.jsp" paramId="id" />
  <display:column property="email" href="details.jsp" paramId="action" paramName="testparam" paramScope="request" />
  <display:column property="status" href="details.jsp" paramId="id" paramProperty="id" />
  </display:table>
  
  這種方法簡便直接,但缺點是無法產(chǎn)生類似details.jsp?id=xx&action=xx的復(fù)合URL
  
  B、應(yīng)用decorator 創(chuàng)建動態(tài)連接:
  
  <display:table name="sessionScope.details" decorator="org.displaytag.sample.Wrapper" >
  <display:column property="link1" title="ID" />
  <display:column property="email" />
  <display:column property="link2" title="Actions" />
  </display:table>
  org.displaytag.sample.Wrapper里的方法:
  public String getLink1()
  {
  ListObject lObject= (ListObject)getCurrentRowObject();
  int lIndex= getListIndex();
  return "<a href=\"details.jsp?index=" + lIndex + "\">" + lObject.getId() + "</a>";
  }
  
  public String getLink2()
  {
  ListObject lObject= (ListObject)getCurrentRowObject();
  int lId= lObject.getId();
  
  return "<a href=\"details.jsp?id=" + lId
  + "&action=view\">View</a> | "
  + "<a href=\"details.jsp?id=" + lId
  + "&action=edit\">Edit</a> | "
  + "<a href=\"details.jsp?id=" + lId
  + "&action=delete\">Delete</a>";
  }
  
  十、分頁
  
  實現(xiàn)分頁非常的簡單,增加一個pagesize屬性指定一次想顯示的行數(shù)即可
  
  <display:table name="sessionScope.test" pagesize="10">
  <display:column property="id" title="ID" />
  <display:column property="name" />
  <display:column property="email" />
  <display:column property="status" />
  </display:table>
  
  十一、排序
  
  排序?qū)崿F(xiàn)也是很簡單,在需要排序的column里增加sortable="true"屬性,headerClass="sortable"僅僅是
  
  指定顯示的樣式。column里的屬性對象要實現(xiàn)Comparable接口,如果沒有的話可以應(yīng)用decorator
  
  defaultsort="1"       默認(rèn)第一個column排序
  defaultorder="descending"  默認(rèn)遞減排序
  <display:table name="sessionScope.stest" defaultsort="1" defaultorder="descending">
  <display:column property="id" title="ID" sortable="true" headerClass="sortable" />
  <display:column property="name" sortable="true" headerClass="sortable"/>
  <display:column property="email" />
  <display:column property="status" sortable="true" headerClass="sortable"/>
  </display:table>
  
  注意的是,當(dāng)同時存在分頁時排序僅僅針對的是當(dāng)前頁面,而不是整個List都進(jìn)行排序
  
  十二、column 分組
  
  分組只是需要在column里增加group屬性
  
  <display:table name="test" class="simple">
  <display:column property="city" title="CITY" group="1"/>
  <display:column property="project" title="PROJECT" group="2"/>
  <display:column property="amount" title="HOURS"/>
  <display:column property="task" title="TASK"/>
  </display:table>
  
  十三、導(dǎo)出數(shù)據(jù)到其他格式(頁面溢出filter??)
  
  在<display:table/>里設(shè)定export="true"
  
  在<display:column/>里設(shè)定media="csv excel xml pdf" 決定該字段在導(dǎo)出到其他格式時被包不包含,不設(shè)定則都包含
  
  <display:setProperty name="export.csv" value="false" />
  
  決定該種格式能不能在頁面中導(dǎo)出
  
  <display:table name="test" export="true" id="currentRowObject">
  <display:column property="id" title="ID"/>
  <display:column property="email" />
  <display:column property="status" />
  <display:column property="longDescription" media="csv excel xml pdf" title="Not On HTML"/>
  <display:column media="csv excel" title="URL" property="url"/>
  <display:setProperty name="export.pdf" value="true" />
  <display:setProperty name="export.csv" value="false" />
  </display:table>
  
  十四、配置屬性,覆蓋默認(rèn)
  
  兩種方法:
  
  A、在程序classpath下新建displaytag.properties文件所有時區(qū)共用,
      建中文編碼則創(chuàng)建displaytag_zh_CN.properties,放到類路徑下,
      jar包內(nèi)共有兩個默認(rèn)的屬性文件TableTag.properties,message.properties
  B、對于單個表格,應(yīng)用<display:setProperty>標(biāo)簽(<display:setProperty name=... value=...>)
  十五、一個完整的例子
  
  <display:table id="test" name="${test}" export="true" sort="list" pagesize="10">
  <display:column property="city" title="城市" group="1" sortable="true" headerClass="sortable"/>
  <display:column property="name" title="名字" group="2" sortable="true" headerClass="sortable"/>
  <display:column property="age" title="年齡"/>
  </display:table>
  
  sort="list" 對整個list進(jìn)行排序
   十六 其它
 
  1)當(dāng)多個表在一頁顯示時,每個表都想要有分頁、排序、導(dǎo)出等功能時,只需為每個table指定一個不同的ID即可。
  2)增加表頭<display:caption>角色管理</display:caption>
  3)增加表尾  <display:footer><tr><td colspan="6" align="center" >HY示例</td></tr></display:footer>
  4)http和email自動鏈接功能,指定autolink="true"
  5)指定一列顯示的最大長度,避免太長把表格變形 maxLength="10" style="whitespace: nowrap;"
  6)當(dāng)列的值為null,使用nulls="false"屬性把null轉(zhuǎn)為空白
  7)<display:setProperty name="export.excel.filename" value="test.xls"/>設(shè)置導(dǎo)出excel的文件名
  8)<display:setProperty name="basic.show.header" value="false"/> 設(shè)置不顯示表頭
  9)在displaytag.properties里修改paging.banner.item_name=記錄后,出現(xiàn)中文顯示亂碼問題,
  解決辦法:
  org.displaytag.properties.TableProperties
  修改
  private String getProperty(String key)
  {
  return this.properties.getProperty(key);
  }
  為
  private String getProperty(String key)
 {
 String s = null;
 try {
 s = new String(this.properties.getProperty(key).getBytes("8859_1"), "GBK");
 }catch(Exception e) {
 s = null;
 }
 return s;
 }
 10)displaytag導(dǎo)出excel文件中文亂碼的解決辦法
  修改org.displaytag.export.ExcelView.java
  public String getMimeType()
  {
   return "application/vnd.ms-excel;charset=GB2312";
  }
 十七 總結(jié)
  我自己使用過程中,遇到顯示當(dāng)前頁數(shù),頁總數(shù)等文字信息為英文的問題,
  需要把displaytag_zh_CN.properties,放到類路徑下就可以了。


Fisher 2008-02-23 09:08 發(fā)表評論
]]>
displayTag學(xué)習(xí)摘要(轉(zhuǎn))http://www.tkk7.com/fisher/articles/181549.htmlFisherFisherSat, 23 Feb 2008 01:06:00 GMThttp://www.tkk7.com/fisher/articles/181549.htmlhttp://www.tkk7.com/fisher/comments/181549.htmlhttp://www.tkk7.com/fisher/articles/181549.html#Feedback0http://www.tkk7.com/fisher/comments/commentRss/181549.htmlhttp://www.tkk7.com/fisher/services/trackbacks/181549.html1.tableTag中name屬性:值默認(rèn)作用域:request
<display:table name="accList">
如果作用域為session,則<display:table name="sessionScope.accList">
tableTag中指定ID屬性會把該對象加入到pageContext對象中去。如ID="test"
<%int cate=((Role)pageContext.getAttribute("test")).getCategory();%>
生成表格的序列號 例如:<display:table id="row" name="mylist">
<display:column title="序列號"><%=pageContext.getAttribute("row_rowNum")%></display:column>
如行號:row_rowNum <c:out value="${row_rowNum}"/>
firstName:row.firstName   <c:out value="${row.firstName}"/>
lastName: row.lastName  全部由ID來取得

2.限制頁面顯示的結(jié)果集數(shù)
1)全部<display:table name="accList" class="its" id="test">
2)頭5個<display:table name="accList" class="its" id="test" length="5">
3)從第二個開始,顯示下5個<display:table name="accList" class="its" id="test" offset="2" length="5">

3.包裝器decorators,有行包裝器(必須繼承TableDecorator)和列包裝器(必須實現(xiàn)ColumnDecorator)
  在tableTag中顯示list時,decorators中的方法會在list前調(diào)用,如果decorators實現(xiàn)類中有相關(guān)的getXXX()方法時,調(diào)用此方法,如果沒有,則直接調(diào)用list
  在columnTag中顯示value時,decorators中的方法會先調(diào)用,(應(yīng)該重用)

4.傳遞參數(shù),有兩種方式,
  一。struts方式:有以下幾個屬性
  1)href 基本的超連接
  2)paramId 添加到url上的參數(shù)名
  <display:column property="status" href="details.jsp" paramId="id" paramProperty="id" />
  3)paramName 傳遞容器內(nèi)的其它bean當(dāng)作參數(shù) 如:request.setAttribute("testparam", "sendamail");
  <display:column property="email" href="details.jsp" paramId="action" paramName="testparam" paramScope="request" />
  4)paramScope 指定bean的作用域
  二。decorators方式
  類Wrapper方法:
public String getLink1()       
{                
    ListObject lObject
= (ListObject)getCurrentRowObject();
    
int lIndex= getListIndex();
    
return  lObject.getId();
}

 
標(biāo)簽:
<display:table name="sessionScope.details" decorator="org.displaytag.sample.Wrapper" >
  <display:column property="link1" title="ID" />
  <display:column property="email" />
</display:table>


5.分頁
  指定屬性:pagesize="10" 每頁顯示10條記錄

6.排序
1)在list中封裝的對象的屬性要實現(xiàn)Comparable接口,(一般均實現(xiàn)了)
2) 在columnTag中指定sortable="true"
  可指定默認(rèn)排序的列 defaultsort="1" 數(shù)值為第幾列默認(rèn)排序 defaultorder="descending" 指定默認(rèn)為降序

7.導(dǎo)出 支持下列格式:'html', 'xml', 'csv', and 'excel'.
  屬性:export="true",注意導(dǎo)出無效,當(dāng)使用jsp:include or the RequestDispatcher
  <display:column media="csv excel" title="URL" property="url"/>
  指定該url屬性值只能在csv、excel中導(dǎo)出
  需要指定export filter.

8.更改默認(rèn)設(shè)置
  1)通過<display:setProperty name=... value=...> 標(biāo)簽,可以覆蓋一些默認(rèn)設(shè)置
  2)創(chuàng)建displaytag.properties文件,所有時區(qū)共用,建中文編碼則創(chuàng)建displaytag_zh_cn.properties,放到類路徑下,jar包內(nèi)共有兩個默認(rèn)的屬性文件TableTag.properties,message.properties

9其它
  1)當(dāng)多個表在一頁顯示時,每個表都想要有分頁、排序、導(dǎo)出等功能時,只需為每個table指定一個不同的ID即可。
  2)增加表頭<display:caption>角色管理</display:caption>
  3)增加表尾  <display:footer><tr><td colspan="6" align="center" >國瑞數(shù)碼版權(quán)所有</td></tr></display:footer>
  4)http和email自動鏈接功能,指定autolink="true"
  5)指定一列顯示的最大長度,避免太長把表格變形 maxLength="10" style="whitespace: nowrap;"
  6)當(dāng)列的值為null,使用nulls="false"屬性把null轉(zhuǎn)為空白 

Trackback: http://tb.blog.csdn.net/TrackBack.aspx?PostId=1500611



Fisher 2008-02-23 09:06 發(fā)表評論
]]>
主站蜘蛛池模板: 野花视频在线官网免费1| 亚洲乱色熟女一区二区三区丝袜| 亚洲第一精品在线视频| a毛片免费观看完整| 亚洲日韩欧洲乱码AV夜夜摸| eeuss影院免费直达入口| 亚洲精品WWW久久久久久| 一级毛片视频免费观看| 中文字幕亚洲一区二区三区| 国产99精品一区二区三区免费| 精品亚洲一区二区三区在线观看| 国产免费牲交视频免费播放| 亚洲综合国产一区二区三区| 野花香在线视频免费观看大全| 亚洲妇熟XXXX妇色黄| 久9热免费精品视频在线观看| 亚洲一级二级三级不卡| 曰批视频免费30分钟成人| 亚洲日本VA午夜在线电影| 亚洲&#228;v永久无码精品天堂久久 | 亚洲五月六月丁香激情| 午夜理伦剧场免费| 亚洲娇小性xxxx色| 免费观看的av毛片的网站| 一级毛片免费不卡| 亚洲经典在线观看| 国产美女无遮挡免费视频网站| 一级毛片大全免费播放下载| 久久久久亚洲AV无码专区首| 免费国产成人高清在线观看网站| 精品国产亚洲第一区二区三区| 亚洲精品高清在线| 2015日韩永久免费视频播放 | 毛片免费视频在线观看| 亚洲AV无码国产一区二区三区| 亚洲中文字幕无码一久久区| 中文字幕在线观看免费视频 | 久久精品国产免费| 亚洲AV日韩综合一区尤物| 亚洲精品亚洲人成在线观看下载| 少妇无码一区二区三区免费|