最近看到了这么个好用的东西,但是在官网上的基本配置也写的感觉迷糊,晚上也没有什么详细的介绍来说配置displaytag的使用。
其实,最后的使用在网上都可以查到,也基本就是那点东西,官网上也写的比较直观详细,不过对于刚接手新的东西来说,可能有些跳过了基本步骤,就像java中classpath的配置,说它不重要吧,它还真是重要,问题也多多。displaytag的配置在网上也没有写出来,其实一说明了。
首先上官网下载最新的displaytag包 http://displaytag.sourceforge.net/11/download.html 现在最新的版本是1.1.1
下载好后将包解压,一般就能看到3个jar包和一个war包,将war包解开,这里面就是基本示例,随便找个看看吧
其中displaytag.propertice文件以及扩展的jar包都可以在里面找到。
web.xml中必须加入
其实,最后的使用在网上都可以查到,也基本就是那点东西,官网上也写的比较直观详细,不过对于刚接手新的东西来说,可能有些跳过了基本步骤,就像java中classpath的配置,说它不重要吧,它还真是重要,问题也多多。displaytag的配置在网上也没有写出来,其实一说明了。
首先上官网下载最新的displaytag包 http://displaytag.sourceforge.net/11/download.html 现在最新的版本是1.1.1
下载好后将包解压,一般就能看到3个jar包和一个war包,将war包解开,这里面就是基本示例,随便找个看看吧
其中displaytag.propertice文件以及扩展的jar包都可以在里面找到。
web.xml中必须加入
<filter>
<filter-name>ResponseOverrideFilter</filter-name>
<filter-class>org.displaytag.filter.ResponseOverrideFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>ResponseOverrideFilter</filter-name>
<url-pattern>*.do</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>ResponseOverrideFilter</filter-name>
<url-pattern>*.jsp</url-pattern>
</filter-mapping>
这两段是用作输出过滤的,diaplaytag可以将list转换到处xls文件,不过我还没有试验,网上好像说是有中文问题,
不过这是必然的吗,谁教计算机是老外发明的那。嗨!!!
jsp页面中调用必须引入以下句,在可以在jar包中WEB-INF目录下找到相应的dtd文件
<%@ taglib uri="http://displaytag.sf.net" prefix="display" %>
<display:table name="someList"> 这里的someList就是你要显示的list对象咯
<display:column property="mail"/>
<display:column property="total"/>
<display:caption>This is the table caption</display:caption>
</display:table>