displaytag导出小实例解析

其中export="true"是必须要的


                                                                                                                                                            
                                                                                                                                                            

这三句话是导出的格式 为true就导出,反之则不导出,displaytag默认导出的格式是csv,xml,xls其中不包括pdf,如果想导出pdf,则需要加入iText.jar和iTextAsian.jar包

配置文件很重要

basic.empty.showtable=false
basic.show.header=true

locale.provider=org.displaytag.localization.I18nJstlAdapter
locale.resolver=org.displaytag.localization.I18nStrutsAdapter
# page | list
sort.amount=page

export.amount=list
export.decorated=true

paging.banner.group_size=8
paging.banner.placement=bottom

以下两句是导出的文件名,是静态的
export.pdf.filename=export
export.excel.filename=export

css.tr.even=even
css.tr.odd=odd
css.th.sorted=sorted
css.th.ascending=order1
css.th.descending=order2
css.table=
css.th.sortable=sortable

# factory classes for extensions
factory.requestHelper=org.displaytag.util.DefaultRequestHelperFactory

# factory class for decorators
factory.decorator=org.displaytag.decorator.DefaultDecoratorFactory

# locale.resolver (nothing by default, simply use locale from request)
#locale.resolver=
# messages

basic.msg.empty_list=\u6CA1\u6709\u53EF\u663E\u793A\u7684\u8BB0\u5F55\u5B58\u5728.
basic.msg.empty_list_row=\u6CA1\u6709\u53EF\u663E\u793A\u7684\u8BB0\u5F55\u5B58\u5728.
error.msg.invalid_page=invalid page

export.banner=

\u5BFC\u51FA\u683C\u5F0F\:{0}
//表示在页面上提示”导出格式:“
export.banner.sepchar= |

paging.banner.item_name=item
paging.banner.items_name=items

paging.banner.no_items_found=\u6CA1\u6709\u8BB0\u5F55\u5B58\u5728.
paging.banner.one_item_found=\u5171\u627E\u52301\u6761\u8BB0\u5F55.
paging.banner.all_items_found=\u5171\u627E\u5230{0}\u6761\u8BB0\u5F55, \u663E\u793A\u6240\u6709\u8BB0\u5F55.
paging.banner.some_items_found=\u5171\u627E\u5230{0}\u6761\u8BB0\u5F55, \u663E\u793A {2} \u5230 {3}.

paging.banner.full=[\u9996\u9875/\u4E0A\u4E00\u9875] {0} [\u4E0B\u4E00\u9875/\u672B\u9875]
paging.banner.first=[\u9996\u9875/\u4E0A\u4E00\u9875] {0} [\u4E0B\u4E00\u9875/\u672B\u9875]
paging.banner.last=[\u9996\u9875/\u4E0A\u4E00\u9875] {0} [\u4E0B\u4E00\u9875/\u672B\u9875]
paging.banner.onepage={0}

paging.banner.page.selected={0}
paging.banner.page.link={0}
paging.banner.page.separator=,

# external sort and pagination
pagination.sort.param=sort
pagination.sortdirection.param=dir
pagination.pagenumber.param=page
pagination.searchid.param=searchid
pagination.sort.asc.value=asc
pagination.sort.desc.value=desc
pagination.sort.skippagenumber=true

# unused
 

对于displaytag导出出现中文乱码问题,大家可能都遇到过

解决办法就是改源码,这里我就不多讲了 网上到处都是,如果有哪位大哥想要已经改好的源码 请留言给我。。。