compound extreme_essential hypertension

compound extreme_essential hypertensioneXtremeComponents的eXtremeTable是一套很好的分页标签,比displayTag好多了。它使用jstl,所以与webwork,Struts,JSF集成也很方便,推荐大家用下面是我使用的例子:ec:table items=”users” var=”user” action=”” imagePath=”${ctx}/widgets/extremecomponent

大家好,又见面了,我是你们的朋友全栈君。如果您正在找激活码,请点击查看最新教程,关注关注公众号 “全栈程序员社区” 获取激活教程,可能之前旧版本教程已经失效.最新Idea2022.1教程亲测有效,一键激活。

Jetbrains全系列IDE使用 1年只要46元 售后保障 童叟无欺

eXtremeComponents的eXtremeTable是一套很好的分页标签,比displayTag好多了。它使用jstl,所以与webwork,Struts,JSF 集成也很方便,推荐大家用

下面是我使用的例子:

compound extreme_essential hypertension

compound extreme_essential hypertension

<
ec:table 
items
=”users”
 var
=”user”
 action
=””
 imagePath
=”${ctx}/widgets/extremecomponents/images/table/zh_CN/*.gif”
 cellpadding
=”1″
 title
=”用户名”
 
compound extreme_essential hypertension locale

=”zh_CN”
 rowsDisplayed
=”10″
>
 
compound extreme_essential hypertension     

<
ec:exportXls 
fileName
=”UserList.xls”
 tooltip
=”Export Excel”
/>

compound extreme_essential hypertension     

<
ec:exportPdf 
fileName
=”UserList.pdf”
 tooltip
=”输出PDF文件”
 headerColor
=”blue”
 headerBackgroundColor
=”blue”
 headerTitle
=”人员表”
/>
 
compound extreme_essential hypertension   

<
ec:exportCsv 
fileName
=”UserList.txt”
 tooltip
=”输出CSV文件”
 delimiter
=”|”
/>
 
compound extreme_essential hypertension
compound extreme_essential hypertension   

<
ec:row
>

compound extreme_essential hypertension    

<
ec:column 
property
=”rowcount”
 cell
=”rowCount”
 sortable
=”false”
 title
=” No.”
 width
=”50″
/>

compound extreme_essential hypertension    

<
ec:column 
property
=”username”
 title
=”姓 名”
 width
=”200″
/>

compound extreme_essential hypertension    

<
ec:column 
property
=”firstName”
  title
=”firstName”
 width
=”200″
/>

compound extreme_essential hypertension    

<
ec:column 
property
=”lastName”
  title
=”lastName”
 width
=”200″
/>

compound extreme_essential hypertension   

</
ec:row
>

compound extreme_essential hypertension  

</
ec:table
>

compound extreme_essential hypertension

Action

compound extreme_essential hypertension
import
 java.util.List;
compound extreme_essential hypertension

import
 javax.servlet.http.HttpServletRequest;
compound extreme_essential hypertension

import
 javax.servlet.http.HttpServletResponse;
compound extreme_essential hypertension

import
 org.apache.struts.action.ActionForm;
compound extreme_essential hypertension

import
 org.apache.struts.action.ActionForward;
compound extreme_essential hypertension

import
 org.apache.struts.action.ActionMapping;
compound extreme_essential hypertension

import
 com.ygsoft.propertyright.service.UserManager;
compound extreme_essential hypertension

import
 com.ygsoft.propertyright.webapp.util.BeanUtil;
compound extreme_essential hypertension
compound extreme_essential hypertensioncompound extreme_essential hypertension

public
 
class
 TestAction 
extends
 BaseAction 

{

compound extreme_essential hypertension    UserManager userManager 
= (UserManager)BeanUtil.getBean(userManager);
compound extreme_essential hypertension    
compound extreme_essential hypertension    
public ActionForward testPage(ActionMapping mapping, ActionForm form, 
compound extreme_essential hypertensioncompound extreme_essential hypertension            HttpServletRequest request, HttpServletResponse response) 
throws Exception {

compound extreme_essential hypertension        List users 
= getUsers();
compound extreme_essential hypertension        request.setAttribute(
users, users);
compound extreme_essential hypertension        
return mapping.findForward(test);
compound extreme_essential hypertension    }

compound extreme_essential hypertension
compound extreme_essential hypertensioncompound extreme_essential hypertension    
public List getUsers() throws Exception {

compound extreme_essential hypertension                 
return userManager.getUsers(null);    
compound extreme_essential hypertension                     }

compound extreme_essential hypertension}

              其中ecoAttrs是一个collection(List),放入pojo。action里面写你这个页面的访问方法(如我的页面是一个action,其他的如.do或者.jsp什么的都可以)。rowsDisplayed是默认显示条数,它可以自动实现分页。
下面的三个<ec:export>是导出三种格式用的,不用的话可以不写(写了需要在web.xml配置相应的filter)。
<ec:column>里面放属性,property指向pojo的相应属性,而title是表头显示的信息,这个标签需要用<ec:row>包起来(1.0.1 m4以后)

这里有一套中文图标:
http://tiny.51.net/extremecomponent/zh_CN.rar

web.xml配置

compound extreme_essential hypertension
<
filter
>
 
compound extreme_essential hypertension     

<
filter-name
>
eXtremeExport
</
filter-name
>
 
compound extreme_essential hypertension    

<
filter-class
>
 org.extremecomponents.table.filter.ExportFilter 
</
filter-class
>
 
compound extreme_essential hypertension

</
filter
>
 
compound extreme_essential hypertension
compound extreme_essential hypertension

<!–
 输出excel,pdf,csv的时候用 
–>

compound extreme_essential hypertension

<
filter-mapping
>
 
compound extreme_essential hypertension

<
filter-name
>
eXtremeExport
</
filter-name
>
 
compound extreme_essential hypertension

<
url-pattern
>
/*
</
url-pattern
>
 
compound extreme_essential hypertension

</
filter-mapping
>
 
compound extreme_essential hypertension
compound extreme_essential hypertension
compound extreme_essential hypertension

<!–
 其实这个配置可不要,已经在放在jar里面了loading的时候自动会加进来- 
–>

compound extreme_essential hypertension

<
taglib
>
 
compound extreme_essential hypertension

<
taglib-uri
>
/extremecomponents
</
taglib-uri
>
 
compound extreme_essential hypertension

<
taglib-location
>
/WEB-INF/tld/extremecomponents.tld
</
taglib-location
>

compound extreme_essential hypertension

<!–
tld拷贝到相应目录去-> 
compound extreme_essential hypertension</taglib> 
compound extreme_essential hypertension

中文问题

export里面的excel和pdf默认不支持中文,需要手工修改源码,excel的比较简单:
修改org.extremecomponents.table.view.XlsView.java(我指的是1.0.1-M4-A14的相应代码)
102行:
HSSFCell hssfCell = hssfRow.createCell(cellnum);
hssfCell.setEncoding(HSSFCell.ENCODING_UTF_16);(就是添加这一行)
122行:
HSSFCell cell = row.createCell(cellnum);
cell.setEncoding(HSSFCell.ENCODING_UTF_16);(就是添加这一行)
这个在使用UTF-8时工作正常。如果其他Unicode环境可以尝试HSSFCell.ENCODING_COMPRESSED_UNICODE。

编译后将对应.class放到WEB-INF/classes相应目录就可以了。

pdf view的比较麻烦,还没尝试,解决方法参照这个帖子:
http://extremecomponents.org/forum/viewtopic.php?t=139&highlight=chinese+filter
http://www-128.ibm.com/developerworks/cn/xml/x-ospdf/index.html

以使用Struts为例,说明一下如何使用eXtremeTable的分页特性

 

   这一切都可以在Action中完成,在Action会用到JSP中eXtremeTable的table标签的属性’tableId’ 和’item’,’tableId’用于完成eXtremeTable的分页,’item’用于返回你分页的结果集,不多不少,刚好是你需要查看的那一页的结果集,比如说,你一页是10条记录,那你访问第20页的时候,’item’的结果集就只有第201条到第210条记录.还有就是在request中加入totalRows的属性,表示本次查询结果的数量

另外,JSP的中,eXtremeTable的table标签要retrieveRowsCallback属性,将该属性设为 org.extremecomponents.table.callback.LimitCallback,这是它默认的分页回调类,你也可以写自已的回调类.设置了该默认的回调类以后,你在Action里就需要向request加入totalRows属性,值为你的查询结果总记录数,这样才会产生翻页的效果.

现在就你的DisplayAction中加分页的特性了,如下:

Limit limit = LimitFactory.createInstanceOfLimit(request, TABLEID);
LimitFactory.setLimitPageAndRowAttr(limit,PAGE_SIZE,TOTAL_SIZE);

这里的TABLEID就是JSP页上标签的属性tableId, PAGE_SIZE是你一页的记录数,TOTAL_SIZE是你查询数据的总数

然后设置totalRow属性,它的值被要求为Integer类型的,转换一下:

request.setAttribute(“totalRows”,new Integer(TOTAL_SIZE));

将分页后的结果集(一页的内容)放到request的resultList(此为JSP中item属性设置的值)属性中去:

request.setAttribute(“resultList”, getTestData(limit.getCurrentRowsDisplayed(),limit.getPage()));

上面得到分页数据的函数原形为getTestData(int pageSize,int paget),通过指定一页的记录数和第几页来获得所需的数据,这可以根据数据库的分页特性,或者通过滑动游标的方式来得到,这里不再傲述.

以下为部分代码:

JSP部分:

compound extreme_essential hypertension
<
ec:table
compound extreme_essential hypertension 

items
=”resultList”
 var
=”item”
 tableId
=”youTableId”

compound extreme_essential hypertension        retrieveRowsCallback

=”org.extremecomponents.table.callback.LimitCallback”

compound extreme_essential hypertension        filterRowsCallback

=”org.extremecomponents.table.callback.LimitCallback”

compound extreme_essential hypertension        sortRowsCallback

=”org.extremecomponents.table.callback.LimitCallback”

compound extreme_essential hypertension action

=”${pageContext.request.contextPath}/DisplayAction.do”

compound extreme_essential hypertension imagePath

=”${pageContext.request.contextPath}/images/table/*.gif”

compound extreme_essential hypertension title

=”TEST”

compound extreme_essential hypertension width

=”100%”

compound extreme_essential hypertension rowsDisplayed

=”10″

compound extreme_essential hypertension        sortable

=”false”

compound extreme_essential hypertension        filterable

=”false”

compound extreme_essential hypertension 

>

compound extreme_essential hypertension        

<
ec:column 
property
=”name”
 title
=”姓名”
/>

compound extreme_essential hypertension        

<
ec:column 
property
=”nickName”
 title
=”别名”
/>

compound extreme_essential hypertension

</
ec:table
>

 

Action部分代码:

compound extreme_essential hypertension
Limit limit 
=
 LimitFactory.createInstanceOfLimit(request, TABLEID);
compound extreme_essential hypertensionLimitFactory.setLimitFilterAndSortAttr(limit);
compound extreme_essential hypertensionLimitFactory.setLimitPageAndRowAttr(limit,PAGE_SIZE,TOTAL_SIZE);
compound extreme_essential hypertensionrequest.setAttribute(


resultList

,getTestData(limit.getCurrentRowsDisplayed(),limit.getPage()));
compound extreme_essential hypertensionrequest.setAttribute(


totalRows

,
new
 Integer(TOTAL_SIZE));

,标签里的rowDisplayed属性要和Action中的PAGE_SIZE一致,不然会有问题…

其他资源
extremecomponents 用AJAX:
http://extremecomponents.org/wiki/index.php/AJAX_enabled_eXtremeTable_Tutorial
extremecomponents Group:
http://groups.google.com:80/group/eXtremeComponents_CN
资源
http://www.blogjava.net:80/lucky/category/7508.html

ECSide发布地址:
1.1版本: http://fins.javaeye.com/blog/51068
1.0版本: http://fins.javaeye.com/blog/40190
ECSide圈子:
http://ecside.javaeye.com/
ECSide综合讨论专用帖
http://fins.javaeye.com/blog/48723
官方网站
http://www.extremecomponents.org

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请联系我们举报,一经查实,本站将立刻删除。

发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/171295.html原文链接:https://javaforall.net

(0)
全栈程序员-站长的头像全栈程序员-站长


相关推荐

  • 我用Python采集了班花的空间数据集,除了美照竟然再一次发现了她另外的秘密![通俗易懂]

    大家好,我是辣条。室友知道了我上次给班花修过电脑,追了我三条街,嘴里大骂我不当人子,怪我这种事情没带他。最后又舔着脸求我支招,这货竟然想追班花!辣条我为了兄弟两(收)肋(钱)插(办)刀(事),毫不犹豫的答应了。但是我只有班花的QQ和微信怎么办呢,那就从她平时发的动态着手,于是就有了这篇文章,不过最后我又发现了她的另一秘密!采集数据目标网址:QQ空间工具使用开发环境:win10、python3.7开发工具:pycharm、Chrome工具包:selenium,re,time.

    2022年4月13日
    36
  • MFC中使用CreateThread创建线程[通俗易懂]

    MFC中使用CreateThread创建线程[通俗易懂]HANDLEm_hListenThread=CreateThread(NULL,0,ThreadProc,this,0,NULL);DOWRDWINAPIThreadProc(LPVOIDlpParameter){xxxx*pxxx=(xxxx*)lpParameter;while(TRUE){//dosomethingSleep

    2022年7月27日
    1
  • j2ee是什么,包括哪些技术_什么是J2EE

    j2ee是什么,包括哪些技术_什么是J2EEjava自学网www.java7.com从整体上讲,J2EE是使用Java技术开发企业级应用的工业标准,它是Java技术不断适应和促进企业级应用过程中的产物。适用于企业级应用的J2EE,提供一个平台独立的、可移植的、多用户的、安全的和基于标准的企业级平台,从而简化企业应用的开发、管理和部署。J2EE是一个标准,而不是一个现成的产品。  主要包括以下这些技术:  1)Servlet  Servlet是Java平台上的CGI技术。Servlet在服务器端运行,动态地生成Web页面。与传统的CGI和..

    2022年10月11日
    0
  • MyBatisPlus–逻辑删除「建议收藏」

    MyBatisPlus–逻辑删除「建议收藏」逻辑删除开发系统时,有时候在实现功能时,删除操作需要实现逻辑删除,所谓欧吉删除就是将数据标记为删除,而并非真正的物理删除(非DELETE操作),查询时需要携带状态条件,确保被标记的数据不被查询,这样做的目的就是避免数据被真正的删除。配置application.properties#删除状态值为1mybatis-plus.global-config.db-config.logic-del…

    2022年5月5日
    74
  • centos7.6安装docker_centos docker安装部署

    centos7.6安装docker_centos docker安装部署前言前面一篇学了mac安装docker,这篇来学习在linux上安装docker环境准备Docker支持以下的CentOS版本,目前,CentOS仅发行版本中的内核支持Docker。Doc

    2022年7月31日
    6
  • tortoisegit使用教程_git小乌龟拉取代码

    tortoisegit使用教程_git小乌龟拉取代码一、下载之前需要下载三个安装包,分别是git、小乌龟客户端、小乌龟中文语言包:二、下载与配置:1.下载Git并且暗转,下载地址:https://git-for-windows.github.io/2.下载TortoiseGit客户端以及中文语言包地址:https://tortoisegit.org/download/此处省略一万个next3.配置TortoiseGit小乌龟首先选择自己需要进行管理的文件夹作为本地Git的仓库,我设置的是D:\A_Projects\OMS1.0然后在文

    2022年9月16日
    0

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

关注全栈程序员社区公众号