displaytag in struts page to complete a large amount of data show

Completed application displaytag in struts page shows a large amount of data, Oracle Database

JSP file:

<% @ Taglib uri = "/ WEB-INF/displaytag.tld" prefix = "disp"%>

<Disp: table name = "resultList" export = "true" pagesize = "100" requestURI = "logQueryAction.do" sort = "external" id = "element" partialList = "true" size = "resultSize">
<Disp: column property = "operdate" title = "Operation Time"> </ disp: column>
<Disp: column property = "pername" title = "operator"> </ disp: column>
<Disp: column property = "opertype" title = "Operation Type"> </ disp: column>
</ Disp: table>
...

name = "resultList" set the record exists in the key session or request
export = "true" export options are displayed
pagesize = "100" data 100 per page
requestURI = "logQueryAction.do" struts in action in the name, if the record low, you can directly page
sort = "external" External Sorting
id = "element" form id value, the parameters for the program were related
partialList = "true" sub-read data from the database
size = "resultSize" record the total number of articles used to calculate the total number of pages

struts action:

String pageIndexName = new org.displaytag.util.ParamEncoder ("element"). EncodeParameterName (org.displaytag.tags.TableTagParameters.PARAMETER_PAGE); / / pages of the parameter name
int pageSize = 100; / / the number of bars per page
int pageIndex = GenericValidator.isBlankOrNull (request.getParameter (pageIndexName))? 0: (Integer.parseInt (request.getParameter (pageIndexName)) - 1); / / Current Page
String sqlCount = "select count (*) from user_log a"; / / total number of records for statistical sql statement
String sql = "select * from (select rownum as rid, t1 .* from (select b.pername as pername, to_char (a.operdate, 'yyyy-mm-dd hh24: mi: ss') as operdate," +
"Decode (a.opertype, 'D', 'delete', 'M', 'modify', 'other') as opertype, a.hphm as hphm from user_log a," +
"(Select asuser.userid as userid, nvl (asempmsg.pername, asuser.loginname) as pername from asuser, ASEMPMSG where asuser.perid = ASEMPMSG.perid (+)) b" +
"Where a.userid = b.userid"; / / query

/ / Construct query
StringBuffer sb = new StringBuffer ();
if (logQueryForm.getCzrqStart ()! = null & &! "". equals (logQueryForm.getCzrqStart ())) (
sb.append ("and a.operdate> to_date ('" + logQueryForm.getCzrqStart () + "', 'yyyy-mm-dd')");
)
if (logQueryForm.getCzrqEnd ()! = null & &! "". equals (logQueryForm.getCzrqEnd ())) (
sb.append ("and a.operdate <= to_date ('" + logQueryForm.getCzrqEnd () + "', 'yyyy-mm-dd')");
)
if (logQueryForm.getCzlx ()! = null & &! "". equals (logQueryForm.getCzlx ())) (
sb.append ("and a.opertype = '" + logQueryForm.getCzlx () + "'");
)
if (logQueryForm.getCzry ()! = null & &! "". equals (logQueryForm.getCzry ())) (
sb.append ("and a.userid = '" + logQueryForm.getCzry () + "'");
)

sqlCount + = sb.toString ();
sql + = sb.toString () + "order by a.operdate desc) t1 where rownum <="
+ (PageIndex + 1) * pageSize + ") t2 where t2.rid>" + pageIndex * pageSize; / / page to read statement

/ / System.out.println (sb.toString ());
DBBean db = new DBBean ();
ResultSet rs = null;
PreparedStatement prep = null;
try (
List resultList = db.getResultList (sql); / / the ResultSet stored in the List in Return
request.setAttribute ("resultList", resultList); / / put the results into request
prep = db.getConnection (). prepareStatement (sqlCount);
rs = prep.executeQuery ();
if (rs.next ()) ... (
request.setAttribute ("resultSize", new Integer (rs.getInt (1))); / / Save the total number of records stored in the request into Intger instance in
)
)
catch (Exception ex) (
ex.printStackTrace ();
)
finally (
if (db! = null) ... (
db.closeConnection (); / / close connection
)
) ... ... ... ... ... ... ...

One page navigation is in English, as long as you can modify the configuration file org.displaytag.properties.TableTag.properties English into Chinese. Also can specify the type of export file and file name.

export.excel = true
export.excel.label = <span class = "export excel"> Excel </ span>
export.excel.include_header = true
export.excel.filename = export.xls

If you do not specify a file name, click the Export excel in time, ie the window will be opened in excel file. Very annoying!
After the specified file name can choose to save and open.

If you do not specify a file name, click the Export excel in time, ie the window will be opened in excel file. Very annoying!

This problem seems to have been resolved in 1.1, display will default to the name table as excel file.

分类:Java 时间:2010-04-01 人气:510
分享到:
blog comments powered by Disqus

相关文章

  • Oracle's SQL statement Daquan (Abstract) 2010-05-27

    SQL statement - Go See the table space Database table space growth in all the inspection: SQL> SELECT A. TABLESPACE_NAME, (1 - (A. TOTAL) / B. TOTAL) * 100 USED_PERCENT FROM (SELECT TABLESPACE_NAME, SUM (BYTES) TOTAL FROM DBA_FREE_SPACE GROUP BY TABL

  • Bank of China transferred to oracle dynamic sql statement 2010-11-12

    create table T_TEST ( CITY VARCHAR2 (255) not null, YEAR NUMBER (4) not null, MONTH NUMBER (2) not null, SELL_AMOUNT NUMBER (26,2) ) comment on table T_TEST is 'on the World Union of the major core city in the amount of sales'; comment on column T_TE

  • Oracle PL / SQL statement simply use (1) 2010-03-11

    - Notes - Single line comment / * * / Multi-line - Simple block declare v_name varchar2 (20); begin v_name: = 'han'; dbms_output.put_line (v_name); end; / - The composition of block list declare v_num number: = 0; begin v_num: = 4/v_num; dbms_output.

  • Oracle PL / SQL statement simply use (2) 2010-03-11

    - DDL statement begin execute immediate 'create table T (nnn varchar2 (20) default''aaa'')'; end; / - If statement - Remove the 7369 salary, if <1200, then the output 'low', if <2000 output of 'middle', otherwise output 'high' - Note the wording els

  • Oracle important sql statement (continuously updated) 2010-08-16

    1, the query operation on the database record of all sql statements select module,first_load_time,sql_text from v$sql order by first_load_time desc; Note: You must be under the dba account to access v $ sql. 2, random queries SELECT * FROM (SELECT *

  • Oracle query SQL statement being executed 2011-02-18

    select OSUSER, PROGRAM, USERNAME, SCHEMANAME, STATUS, B.SQL_TEXT from V$SESSION A, V$SQL B where A.SQL_ADDRESS = B.ADDRESS AND A.SQL_HASH_VALUE = B.HASH_VALUE and OSUSER = 'lkf' AND USERNAME = 'APPS' // Later you can add you to constraint Results as

  • oracle's sql statement (constantly updated ...) 2010-12-16

    Change one field alter table tb_test modify permile number (5,2);

  • Original: oracle PL / SQL programming based on the <eleven> 2011-04-29

    PL/SQL Is the oracle of the special language , Its standard SQL language extensions .SQL Statements can be nested in a PL / SQL language , Combined processing statement . PL/SQL Program Structure Use the block structure of the organization code. The

  • SQL Server and Oracle database on the differences in query optimization 2011-03-18

    [IT News Writer In general, Oracle database data in a large environment, its operating performance than the higher efficiency of the SQL Server database. From the query optimization in terms of a single, relatively large differences between the two t

  • oracle and sql server query SQL statement page 2010-03-25

    1.Oracle paging sql statement SELECT * FROM (SELECT A.*, ROWNUM RN FROM ( select sno,sname,sage,ssex from tb_student where 1=1 ) A WHERE ROWNUM <'24') WHERE RN >='0' 2.Sql Server paging sql statement SELECT sno,sname,sage,ssex FROM ( SELECT ROW_NUMB

iOS 开发

Android 开发

Python 开发

JAVA 开发

开发语言

PHP 开发

Ruby 开发

搜索

前端开发

数据库

开发工具

开放平台

Javascript 开发

.NET 开发

云计算

服务器

Copyright (C) codeweblog.com, All Rights Reserved.

CodeWeblog.com 版权所有 黔ICP备15002463号-1

processed in 0.341 (s). 12 q(s)