转:displaytag使用大杂烩

<%@ page language="java" pageEncoding="UTF-8"%>  
<%@ page import="org.displaytag.decorator.TotalTableDecorator"%>  
<%@ include file="/inc/tool.jsp" %>  
<%   
String path = request.getContextPath();   
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";   
%>  
  
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">  
<html>  
  <head>  
    <base href="<%=basePath%>">  
       
    <title>displaytag标签示例</title>  
       
    <meta http-equiv="pragma" content="no-cache">  
    <meta http-equiv="cache-control" content="no-cache">  
    <meta http-equiv="expires" content="0">       
    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">  
    <meta http-equiv="description" content="This is my page">  
    <!--link rel="stylesheet" type="text/css" href="/css/site.css"-->  
       
    <style>  
     body,td{font:normal 12px Verdana;color:#333333}   
     input,textarea,select,td,{font:normal 12px Verdana;color:#333333;border:1px solid #999999;background:#ffffff}   
     th{font:normal 14px Verdana;color:#333333;border:1px solid #999999;background:#C0C0C0}   
     table{border-collapse:collapse;}   
     td{padding:3px}   
     input{height:20;}   
     textarea{width:80%;height:50px;overfmin:auto;}   
     form{display:inline}   
     table{width: 100%;}   
    </style>  
  </head>  
   <jsp:scriptlet>  
        TotalTableDecorator tt=new TotalTableDecorator();   
        tt.setSubtotalLabel("{0} 小计");   
        tt.setTotalLabel("合计");   
        request.setAttribute("total",tt);   
   </jsp:scriptlet>  
  <body>  
  <h2>displaytag示例程序</h2>  
    <display:table name="result" id="row" pagesize="10" requestURI="user.do" export="true" defaultsort="2" defaultorder="ascending" decorator="total">  
        <display:caption>这是一个例子</display:caption>  
        <display:column title="序号">${row_rowNum}</display:column>  
           
        <display:column property="country" title="国家" sortable="true" group="1"/>  
        <display:column property="city" title="城市" sortable="true" />  
        <display:column property="name" title="姓名" paramId="id" href="user.do?method=getList" paramProperty="id" sortable="true"/>  
        <display:column property="sex" title="性别" sortable="true"/>  
        <display:column property="id" title="ID" sortable="true" />  
        <display:column property="email" title="电子邮件地址" sortable="true"/>  
        <display:column property="password" title="密码" sortable="true"/>  
           
           
        <display:column property="birthDate" title="出生日期" format="{0,date,yyyy-MM-dd}" sortable="true"/>  
        <display:column property="mobilePhone" title="移动电话" sortable="true"/>  
        <display:column title="地址" sortable="true">${row.address }</display:column>  
        <display:column property="laborage" title="工资" sortable="true" total="true" format="{0,number,0,000.00}"/>  
        <display:column property="performance" title="绩效" sortable="true" total="true" format="{0,number,00.0}"/>  
        <display:column title="操作"><a href="<%=path %>/user.do?method=getList&id=${row.id }">修改</a> | 查看 | 删除</display:column>  
    </display:table>  
     
     
<hr>  
  pagesize="3" : 分页,每页显示3条数据<br>  
  requestURI="user.do" :分页跳转的地址<br>  
  sortable="true" : 该列可以排序<br>  
  defaultsort="3" : 默认按第几列排序<br>  
  defaultorder="ascending" : 默认的排序方式;有ascending和descending <br>  
  group="1" : 按当前列分组显示<br>  
  total="true" : 统计当前列,分组时可自动统计每组小计.但需要在table加入decorator="org.displaytag.decorator.TotalTableDecorator"标签<br>  
  export="true" : 根据displaytag.properties文件配置,导出不同类型文件<br>  
  maxLength="60" : 限制字符串长度为60个字符<br>  
  property="nullValue" nulls="false" : 表示该单元格值为空,即不显示<br>  
  format="email is {0}" : 格式化email地址,显示为email is [email protected]<br>  
  format="{0,date,dd-MM-yyyy}" : 格式化日期,显示为11-08-2008<br>  
  format="{0,number,0,000.00} $" : 格式化金额,显示为4,909.00 $<br>  
  </body>  
</html>  

你可能感兴趣的:(html,jsp,xml,css)