??xml version="1.0" encoding="utf-8" standalone="yes"?>精品女同一区二区三区在线观看,亚洲一区二区三区四区五区午夜,成人羞羞视频免费http://www.aygfsteel.com/RongHao/archive/2006/11/27/83858.htmlronghaoronghaoMon, 27 Nov 2006 10:51:00 GMThttp://www.aygfsteel.com/RongHao/archive/2006/11/27/83858.htmlhttp://www.aygfsteel.com/RongHao/comments/83858.htmlhttp://www.aygfsteel.com/RongHao/archive/2006/11/27/83858.html#Feedback1http://www.aygfsteel.com/RongHao/comments/commentRss/83858.htmlhttp://www.aygfsteel.com/RongHao/services/trackbacks/83858.html考虑一个内容节点Content,其中节点有个pagecontent的属性,q个属性用来存储用户在后台输入的内容,
内容+模板=昄Q这里是Q?br />内容+模板-->昄?rn)态html
内容用FCK来编辑,模板也同L(fng)FCK~辑Q这里用freemarker无疑是一个好的选择。这里是个最单的例子?br />首先定义一个最单的模板content.ftl
<html>
$
{content}
</html>
然后是把内容填充进去:(x)
 (tng)Configuration (tng)cfg (tng)= (tng)new (tng)Configuration();
 (tng)
//模板存储的目?/span>
 (tng)cfg.setDirectoryForTemplateLoading(Path.getTemplateDirectory());
 (tng)
//默认
 (tng)cfg.setObjectWrapper(new (tng)DefaultObjectWrapper());
//填充数据 (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng)
Map (tng)root (tng)= (tng)new (tng)HashMap();
root.put(
"content", (tng)c.getPageContent());
 (tng) (tng) (tng) (tng) (tng)Template (tng)temp (tng)
= (tng)cfg.getTemplate("content.ftl");
//发布日期
String (tng)date=c.getActivedate();
String (tng)filename (tng)
= (tng)c.getId()+".html";
//创徏目录
Path.createFold(Path.getWebCmsHtmlDirPath(),date);
Writer (tng)out (tng)
= (tng)new (tng)OutputStreamWriter(new (tng)FileOutputStream(Path.getWebCmsHtmlDirPath()+"/"+date+"/"+filename));
temp.process(root, (tng)out);
out.flush();
其实是q么单!对html的管理就很容易了(jin)Q基本的FILE操作

ronghao 2006-11-27 18:51 发表评论
]]>
面标签tld位置http://www.aygfsteel.com/RongHao/archive/2006/10/12/74798.htmlronghaoronghaoThu, 12 Oct 2006 07:50:00 GMThttp://www.aygfsteel.com/RongHao/archive/2006/10/12/74798.htmlhttp://www.aygfsteel.com/RongHao/comments/74798.htmlhttp://www.aygfsteel.com/RongHao/archive/2006/10/12/74798.html#Feedback0http://www.aygfsteel.com/RongHao/comments/commentRss/74798.htmlhttp://www.aygfsteel.com/RongHao/services/trackbacks/74798.htmlJsp中非常简单:(x)
<%@ taglib prefix="authz" uri="但记得自己没有在web.xml中声明这个标{,咋就跑v来了(jin)呢?google一下,原来authz.tld被打入jar包的META-INF?br />呵呵Q记录一?img src ="http://www.aygfsteel.com/RongHao/aggbug/74798.html" width = "1" height = "1" />

ronghao 2006-10-12 15:50 发表评论
]]>
webwork保存囄到数据库http://www.aygfsteel.com/RongHao/archive/2006/06/15/53030.htmlronghaoronghaoThu, 15 Jun 2006 09:14:00 GMThttp://www.aygfsteel.com/RongHao/archive/2006/06/15/53030.htmlhttp://www.aygfsteel.com/RongHao/comments/53030.htmlhttp://www.aygfsteel.com/RongHao/archive/2006/06/15/53030.html#Feedback0http://www.aygfsteel.com/RongHao/comments/commentRss/53030.htmlhttp://www.aygfsteel.com/RongHao/services/trackbacks/53030.html

开发中遇到q么一个要求,用户USERq个PO里需要保存用L(fng)照片。一般情况下有两U处理方法:(x)一是直接保存图片到数据库;二是保存囄到服务器端,PO字段保存一个联接。考虑到用L(fng)片一般较?yu),采用W一U方法?br />

 (tng)1 public  (tng) class  (tng)User (tng) extends  (tng)Principal (tng) {
 (tng)2  (tng) (tng) (tng) (tng) private  (tng) byte [] (tng)photo; (tng) (tng) (tng) // 考虑与各U数据库兼容问题
 (tng)3  (tng) (tng) (tng) (tng) public  (tng) byte [] (tng)getPhoto() (tng) {
 (tng)4  (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) return  (tng)photo;
 (tng)5  (tng) (tng) (tng) (tng)}

 (tng)6
 (tng)7  (tng) (tng) (tng) (tng) public  (tng) void  (tng)setPhoto( byte [] (tng)photo) (tng) {
 (tng)8  (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) this .photo (tng) =  (tng)photo;
 (tng)9  (tng) (tng) (tng) (tng)}

10  (tng) (tng) (tng) (tng)..
11 }

12


面里面Q直接用webwork的FileUploadInterceptor拦截

< @ww.form (tng) (tng)enctype = " multipart/form-data "  (tng)action = " doUpdateUser "  (tng) (tng)method = " post " >
< image (tng)name = " img1 "  (tng)src = " /getUserPhoto.action?userId=${user.id} "  (tng)width = 90  (tng)height = 120  (tng)border = " 0 " ></ image >
< @ww.file (tng)label = " %{getText('user.photo')} "  (tng)name = " photo "  (tng) />
</ @ww.form >


xwork.xml里的配置

 (tng) (tng) (tng) (tng) (tng) (tng) (tng) < action (tng)name = " doUpdateUser "  (tng) class = " com.ronghao.organization.action.OrganizationAction "  (tng)method = " updateUser " >
 (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng)
< interceptor - ref (tng)name = " defaultStack " >
 (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng)
< param (tng)name = " fileUpload.allowedTypes " >
 (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng)image
/ x - png,image / gif,image / pjpeg
 (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng)
</ param >
 (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng)
</ interceptor - ref >
 (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng)
< result (tng)name = " success " >/ organization / user.ftl </ result >
 (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng)
</ action >

 (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng)
< action (tng)name = " getUserPhoto "  (tng) class = " com.ronghao.organization.action.OrganizationAction "  (tng)method = " getUserPhoto " >
 (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng)
< result >/ organization / user.ftl </ result >
 (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng)
</ action >


引用默认的拦截器栈,栈里已经包含FileUploadInterceptor拦截Q这里配|FileUploadInterceptor拦截的参敎ͼ讑֮上传的文件ؓ(f)囄
格式
Actionc?br />

 (tng)1 public  (tng) class  (tng)OrganizationAction (tng) extends  (tng)BaseOrganizationAction {
 (tng)2  (tng) (tng) (tng) (tng) private  (tng)File (tng)photo; (tng) (tng) // 与页面里的上传文件字D名对应
 (tng)3  (tng) (tng) (tng) (tng) private  (tng)OutputStream (tng)outPhoto
 (tng)4
 (tng)5  (tng) (tng) (tng) (tng) (tng) /**
 (tng)6  (tng) (tng) (tng) (tng) (tng)* (tng)更新用户信息
 (tng)7  (tng) (tng) (tng) (tng) (tng)*
 (tng)8  (tng) (tng) (tng) (tng) (tng)* (tng) @return
 (tng)9  (tng) (tng) (tng) (tng) (tng)* (tng) @throws  (tng)Exception
10  (tng) (tng) (tng) (tng) (tng) */

11  (tng) (tng) (tng) (tng) public  (tng)String (tng)updateUser() (tng) throws  (tng)Exception (tng) {
12  (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) // 以下Z存图?视情况修?/span>
13  (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) if  (tng)( null  (tng) !=  (tng)photo) (tng) {
14  (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng)FileInputStream (tng)file (tng) =  (tng) new  (tng)FileInputStream(photo);
15  (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) int  (tng)length (tng) =  (tng)file.available();
16  (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) byte [] (tng)buffer (tng) =  (tng) new  (tng) byte [length];
17  (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng)file.read(buffer);
18  (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng)file.close();
19  (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng)user.setPhoto(buffer); (tng) (tng) (tng) // 上传的囄转换为字节数l存储到PO?/span>
20  (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng)}

21  (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng)organizationService.updateUser(user);
22  (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) return  (tng)SUCCESS;
23  (tng) (tng) (tng) (tng)}

24
25  (tng) (tng) (tng) (tng) public  (tng)String (tng)getUserPhoto() (tng) throws  (tng)Exception (tng) {
26  (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng)user (tng) =  (tng)organizationService.getUserById(userId);
27  (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) if  (tng)(user.getPhoto() (tng) !=  (tng) null ) (tng) {
28  (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng)outPhoto (tng) =  (tng) this .getResponse().getOutputStream(); (tng) // PO中字节数l{换ؓ(f)输出?/span>
29  (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng)outPhoto.write(user.getPhoto());
30  (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng)outPhoto.flush();
31  (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng)outPhoto.close();
32  (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng)}

33  (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) return  (tng)SUCCESS;
34  (tng) (tng) (tng) (tng)}

35 }

36


q样O(jin)K?jin),考虑一个问题,是action 必须要指定一个result Q实际这里的囄昄仅仅是要一个输出流

< image (tng)name = " img1 "  (tng)src = " /getUserPhoto.action?userId=${user.id} "  (tng)width = 90  (tng)height = 120  (tng)border = " 0 " ></ image >


而我的配|里面是

< result >/ organization / user.ftl </ result >


不知道这?x)不会(x)有什么媄(jing)响。或者这P

< result >/ organization / blank.ftl </ result >


ronghao 2006-06-15 17:14 发表评论
]]>
用Tomcat实现容器内认?/title><link>http://www.aygfsteel.com/RongHao/archive/2005/12/28/25714.html</link><dc:creator>ronghao</dc:creator><author>ronghao</author><pubDate>Wed, 28 Dec 2005 06:00:00 GMT</pubDate><guid>http://www.aygfsteel.com/RongHao/archive/2005/12/28/25714.html</guid><wfw:comment>http://www.aygfsteel.com/RongHao/comments/25714.html</wfw:comment><comments>http://www.aygfsteel.com/RongHao/archive/2005/12/28/25714.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.aygfsteel.com/RongHao/comments/commentRss/25714.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/RongHao/services/trackbacks/25714.html</trackback:ping><description><![CDATA[<P><STRONG>在数据库里新Z个表</STRONG><BR>A、用戯<BR>create table users (user_name varchar(20) not null, <BR>                               user_pass varchar(20) not null, <BR>                               PRIMARY KEY (user_name)) ;<BR>B、用户与角色兌?BR>create table user_roles (user_name varchar(20) not null,<BR>                                        role_name varchar(20) not null, <BR>                                        PRIMARY KEY (user_name)) ;<BR>C、插入数?BR>insert into users values('user1', 'password');<BR>insert into user_roles values('user1', 'manager');</P> <P><STRONG>在tomcat的server.xml里加入描q?BR></STRONG>      <Realm  className="org.apache.catalina.realm.JDBCRealm"<BR>              driverName="org.gjt.mm.mysql.Driver"<BR>              connectionURL="jdbc:mysql://localhost/databaseName"<BR>              connectionName=yourname connectionPassword=yourpassword<BR>              userTable="users" userNameCol="user_name" userCredCol="user_pass"<BR>              userRoleTable="user_roles" roleNameCol="role_name" /></P> <P><STRONG>在自己应用程序的web.xml里加入描qͼZ表单Q?/STRONG><BR><security-constraint><BR>  <web-resource-collection><BR>   <web-resource-name>My Test</web-resource-name><BR>   <url-pattern>/get.jsp</url-pattern><BR>  </web-resource-collection><BR>  <auth-constraint><BR>    <role-name>manager</role-name>    //能够讉K的角Ԍ可以多个<BR>  </auth-constraint><BR></security-constraint></P> <P><login-config><BR>  <auth-method>FORM</auth-method><BR>    <realm-name>My Test</realm-name><BR>  <form-login-config><BR>  <form-login-page>/login.jsp</form-login-page><BR>  <form-error-page>/fail_login.html</form-error-page>  //认证p|后蟩转的面<BR>  </form-login-config><BR></login-config></P> <P><STRONG>d表单必须包含输入用户姓名和口令的字段Q它们必被分别命名为j_username和j_passwordQ表单将q二个值发送给j_security_check逻辑名字?/STRONG><BR>  下面是一个该表单如何在HTML|页中实现的例子Q?BR><form method="POST" action="j_security_check"><BR>  <input  type="text" name="j_username"><BR>  <input  type="password" name="j_password"><BR>    <input  type="submit" value="定"/><BR></form> </P> <P>q样当对get.jspq行讉KӞtomcat׃(x)自动转到l(f)ogin.jsp面实现认证。对于简单的认证Q小型系l,采用Tomcat实现容器内认证是方便的?/P><img src ="http://www.aygfsteel.com/RongHao/aggbug/25714.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/RongHao/" target="_blank">ronghao</a> 2005-12-28 14:00 <a href="http://www.aygfsteel.com/RongHao/archive/2005/12/28/25714.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>DisplayTag应用http://www.aygfsteel.com/RongHao/archive/2005/12/08/22990.htmlronghaoronghaoThu, 08 Dec 2005 08:10:00 GMThttp://www.aygfsteel.com/RongHao/archive/2005/12/08/22990.htmlhttp://www.aygfsteel.com/RongHao/comments/22990.htmlhttp://www.aygfsteel.com/RongHao/archive/2005/12/08/22990.html#Feedback18http://www.aygfsteel.com/RongHao/comments/commentRss/22990.htmlhttp://www.aygfsteel.com/RongHao/services/trackbacks/22990.html  DisplayTag是一个非常好用的表格昄标签Q适合MVC模式Q其主页?A >http://displaytag.sourceforge.net 
一、最单的情况Q未使用<display:column/>标签
  <%request.setAttribute( "test", new ReportList(6) );%>
  <display:table name="test" />
  标签遍历List里的每一个对象,q将对象里的所有属性显C出来。一般用于开发的时候检查对象数据的完整性?BR> 
二、?lt;display:column/>标签的情?/STRONG>
<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对应List里对象的属性(用getXXX()Ҏ(gu)取得Q,title则对应表D头里的列名。定义列有两U方式:(x)
   A?lt;display:column property="email" />
      使用<display:column/>标签里的property属性来定义
   B?lt;display:column title="email">email@it.com</display:column>
      ?lt;display:column/>标签体里增加内容Q可以是帔RQ也可以用其他标{{?BR>   两种方式比较Q用property属性来定义更加快速和利于排序?BR>  
三、表格显C样式的定义
  A、在<display:table/>?lt;display:column/>标签里指定标准的html属性,?ch)?BR>  B、修Ҏ(gu)式表
<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属性来指定所要应用的样式。可以在光认样式表里(./css/screen.cssQ直接修?BR>  
四、标{֏得数据的数据?BR>  有四U范?BR>   pageScope
   requestScope (默认)  <display:table name="test2" >
   sessionScope  <display:table name="sessionScope.holder.list" > 注意Q这里要指定范围Q非默认
   applicationScope
  
五、通过增加id属性创建隐含的对象
<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/>里增加了(jin)id属性,q时在page context里创Z(jin)一个隐含对象,指向List里的当前对象Q?BR>   可以通过(ListObject)pageContext.getAttribute("id")来捕莯个对象。同时还创徏?jin)一个id_rowNum对象Q同P?BR>   通过pageContext.getAttribute("testit_rowNum")来捕P它仅仅代表当前行的行数?BR>   有了(jin)q两个隐含对象,可以通过其他标签来访问,例如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>
 
六、显C部分数?/STRONG>
   昄开始五条数据:(x)通过讑֮length属?BR><display:table name="test" length="5">
  <display:column property="id" title="ID" />
  <display:column property="email" />
  <display:column property="status" />
</display:table>
   昄W三到第八条数据Q通过讑֮offset和length属?BR><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地址的直接连?/STRONG>
 <display:table name="test" >
  <display:column property="id" title="ID" />
  <display:column property="email" autolink="true" />
  <display:column property="url" autolink="true" />
 </display:table>
 如果要显C的对象里包含email和url地址Q则可以在display:column里直接设定autolink="true"来直接连?BR> 
八、用装饰模式{换数据显C(写自q decorator Q?/STRONG>
  A、对整个表格应用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卌己写的decoratorQ它要承TableDecoratorc,看看它的一个方法:(x)
        public String getMoney()
    {
        return this.moneyFormat.format(((ListObject) this.getCurrentRowObject()).getMoney());
    }
    很明显,它通过父类的getCurrentRowObject()Ҏ(gu)获得当前对象Q然后对其getMoney()Ҏ(gu)q行‘a(b)漆?BR>  B、对单独的column应用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要实现ColumnDecorator接口Q它的方法:(x)
        public final String decorate(Object columnValue)
    {
        Date date = (Date) columnValue;
        return this.dateFormat.format(date);
    }
    昄Q它获得不了(jin)当前对象Q因为它实现的是接口Q,仅仅是获得该对象的columnValueQ然后‘a(b)漆?BR>   
?ji)、创建动态连?BR>   有两U方法创建动态连接:(x)
   A、在<display:column/>里通过增加href、paramId、paramName、paramScope、paramProperty属?BR>      href             基本的URL 地址
      paramId          加在URL 地址后的参数名称
      paramName        数据bean的名Uͼ一般ؓ(f)nullQ即使用当前List里的对象Q?BR>      paramScope       数据bean的范_(d)一般ؓ(f)null
      paramProperty    数据bean的属性名Uͼ用来填充URL 地址后的参数?BR><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> 
    q种Ҏ(gu)便直接,但缺Ҏ(gu)无法产生cMdetails.jsp?id=xx&action=xx的复合URL
   B、应用decorator 创徏动态连接:(x)
<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里的Ҏ(gu)Q?BR> 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>";
 }

十、分?BR>   实现分页非常的简单,增加一个pagesize属性指定一ơ想昄的行数即?BR><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>

十一、排?BR>   排序实现也是很简单,在需要排序的column里增加sortable="true"属性,headerClass="sortable"仅仅?BR>   指定昄的样式。column里的属性对象要实现Comparable接口Q如果没有的话可以应用decorator
   defaultsort="1"              默认W一个column排序
   defaultorder="descending"    默认递减排序
<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>
  注意的是Q当同时存在分页时排序仅仅针对的是当前页面,而不是整个List都进行排?BR> 
十二、column 分组
   分组只是需要在column里增加group属?BR><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>

十三、导出数据到其他格式Q页面溢出filter??Q?/STRONG>
   ?lt;display:table/>里设定export="true"
   ?lt;display:column/>里设定media="csv excel xml pdf" 军_该字D在导出到其他格式时被包不包含,不设定则都包?BR>   <display:setProperty name="export.csv" value="false" />
   军_该种格式能不能在面中导?BR><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>

十四、配|属性,覆盖默认
  两种Ҏ(gu)Q?BR>  A、在E序classpath下新建displaytag.properties文g
  B、对于单个表|应用<display:setProperty>标签
  具体可配|的属性:(x)http://displaytag.sourceforge.net/configuration.html
 
十五、一个完整的例子
<display:table name="test" export="true" sort="list" pagesize="8">
  <display:column property="city" title="CITY" group="1" sortable="true"    headerClass="sortable"/>
  <display:column property="project" title="PROJECT" group="2" sortable="true" headerClass="sortable"/>
  <display:column property="amount" title="HOURS"/>
  <display:column property="task" title="TASK"/>
</display:table>
   sort="list" Ҏ(gu)个listq行排序
   导出数据到其他格式时Qgroup无效



ronghao 2005-12-08 16:10 发表评论
]]>
վ֩ģ壺 | лͨ| | ˮ| ɳ| | | | ˳| ľ| | ӻ| | ׺| ̨ʡ| Ž| | н| ˶| Զ| | | ɽ| | گ| | | | ľ| ո| | | | | | | | ͼľ| Ϫ| | ¡|