Professional Documents
Culture Documents
......................................................................................................................................
displaytag
TABLE OF CONTENTS
Table of Contents
......................................................................................................................................
TABLE OF CONTENTS
Overview
1.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.2 Dependencies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
Reference
2.1 Download . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
2.2 Install . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
2.3 Tlds . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
2.4 Tag reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
2.5 Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
2.6 Export filter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
Tutorial
Feedback
4.1 FAQ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
4.2 Reporting bugs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
4.3 Mailing Lists . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
Developers
ii
1.1 INTRODUCTION
1.1
Introduction
......................................................................................................................................
Overview
$
$ %
$
& '()
*
+, +
1.2 DEPENDENCIES
1.2
Dependencies
......................................................................................................................................
Dependencies
!
-
.
/
Required at runtime
Artifact ID
Type
Version
URL/comments
commons-beanutils
jar
1.6.1
http://jakarta.apache.org/commons/beanutils
commons-collections
jar
2.1.1
commons-lang
jar
2.0
commons-logging
jar
1.0.4
http://jakarta.apache.org/commons/logging
Type
Version
URL/comments
jstl
jar
1.0.2
http://jakarta.apache.org/taglibs/doc/standard-1.0-doc/
standard
jar
1.0.4
http://jakarta.apache.org/taglibs/
Type
Version
URL/comments
itext
jar
0.99
1.2 DEPENDENCIES
Artifact ID
Type
Version
URL/comments
portlet-api
jar
unknown
log4j
jar
1.2.8
maven-taglib-plugin
plugin
1.2
servletapi
jar
2.3
httpunit
jar
1.6
jtidy
jar
nekohtml
jar
0.9.1
js
jar
1.5R4.1
jasper-compiler
jar
4.0.4
jasper-runtime
jar
4.0.4
xerces
jar
2.4.0
xml-apis
jar
1.0.b2
tools
jar
1.3
Struts
jar
1.2.4
Spring
jar
1.1.1
commons-digester
jar
1.4.1
webwork
jar
2.1.5
xwork
jar
1.0.3
oscore
jar
2.2.4
ognl
jar
2.6.5
2.1 DOWNLOAD
2.1
Download
......................................................................................................................................
Download
releases
.
/
#
3%
. /
source code from CVS
0 12 1 1$ 1 4
Files
55 +
6 displaytag.jar ! $
2.2 INSTALL
2.2
Install
......................................................................................................................................
Installation Guide
+
file
description
displaytag.war
displaytag.jar
displaytag.tld
+ <
= >!
6 !
6 !
6 !
6 !
6 ?!!
STEP 3
+
<
= >
+
<
3789:;23%
STEP 4
<taglib>
<taglib-uri>http://displaytag.sf.net</taglib-uri>
<taglib-location>/WEB-INF/displaytag-{taglibversion}.tld</taglib-location>
</taglib>
2.2 INSTALL
+ <
$
%
1 %
STEP 5
2
$
+
+33!
3 3
2.3 TLDS
2.3
Tlds
......................................................................................................................................
Tlds
<
G )
tld
URI
description
displaytag-11.tld
http://displaytag.sf.net
displaytag-12.tld
http://displaytag.sf.net
displaytag-el-12.tld
http://displaytag.sf.net/el
2.4
Tag reference
......................................................................................................................................
table
<
$
C $
$
1
%
1$ 8%$ ')
$
:
1 $
!
+$
- C4:
+ @1A
Example
Attributes
Name
Description
Type
cellpadding
String
cellspacing
String
class
String
decorator
String
String
int
String
boolean
frame
String
htmlId
String
id
String
length
int
list
String
String
offset
int
pagesize
int
requestURI
String
boolean
defaultorder
defaultsort
excludedParams
export
name
requestURIcontext
10
Name
Description
Type
rules
String
sort
String
style
String
summary
String
uid
String
styleClass
String
align
String
String
String
String
String
String
String
String
String
String
background
bgcolor
height
hspace
vspace
width
border
scope
property
column
<
! C1
.
/I
F
F I
11
F
F $ @1A
+ @1A
Attributes
Name
Description
Type
autolink
boolean
String
String
int
String
String
int
class
decorator
group
headerClass
href
maxLength
12
Name
Description
Type
maxWords
int
String
boolean
String
String
String
String
boolean
media
nulls
paramId
paramName
paramProperty
property
sortable
13
Name
Description
Type
sortProperty
String
style
String
title
String
titleKey
String
String
String
styleClass
String
headerStyleClass
String
sort
boolean
align
String
String
String
String
String
String
String
url
width
background
bgcolor
height
nowrap
valign
paramScope
14
setProperty
1
C1
$
I
<
A
)1 !
+ @1A
Example
Attributes
Name
Description
Type
*name
String
String
value
footer
+ @1A
Example
<display:table name="someList">
<display:column property="mail"/>
<display:column property="total"/>
<display:footer>
<tr>
<td>total:</td>
<td><c:out value="${something}" /></td>
<tr>
</display:footer>
15
</display:table>
Attributes
caption
1
C
+ @1A
Example
<display:table name="someList">
<display:column property="mail"/>
<display:column property="total"/>
<display:caption>This is the table caption</display:caption>
</display:table>
Attributes
Name
Description
Type
class
String
dir
String
id
String
lang
String
style
String
title
String
2.5 CONFIGURATION
2.5
16
Configuration
......................................................................................................................................
Configuration properties
TableTag.properties
!
E
+
6 2
<
- !
I
- %
$
6 2 $ *
+ A
,
:
:
$
!
I18n
1
)
displaytag.properties
&
. %
displaytag_IT.properties /
Generic
Can be set using
file/setProperty
Property
Default
Valid Values
Description
basic.show.header
true
true, false
yes/yes
yes/yes
basic.empty.showtable
false
true, false
2.5 CONFIGURATION
17
Property
Default
Valid Values
Description
basic.msg.empty_list
Any string
basic.msg.empty_list_row
<tr class="empty"><td
colspan="{0}">Nothing
found to display.</td></tr>
Any string
sort.amount
page
page, list
yes/no
yes/yes
yes/yes
yes/yes
yes/yes
yes/yes
yes/yes
export.banner
<div class="exportlinks">
Export options: {0} </div>
export.banner.sepchar
Any string
paging.banner.placement
top
paging.banner.item_name
item
Any string
paging.banner.items_name items
Any string
paging.banner.no_items_found
<span
class="pagebanner"> No
{0} found. </span>
2.5 CONFIGURATION
Property
18
Default
paging.banner.one_item_found
<span
class="pagebanner"> One
{0} found. </span>
Valid Values
Description
yes/yes
yes/yes
yes/yes
paging.banner.all_items_found
<span
class="pagebanner"> {0}
{1} found, displaying all
{2}. </span>
paging.banner.some_items_found
<span
class="pagebanner"> {0}
{1} found, displaying {2} to
{3}. </span>
Any string
paging.banner.group_size
yes/yes
yes/yes
paging.banner.full
<span class="pagelinks">
[<a href="{1}">First</a>/
<a href="{2}">Prev</a>]
{0} [ <a
href="{3}">Next</a>/ <a
href="{4}">Last
</a>]</span>
paging.banner.first
<span class="pagelinks">
[First/Prev] {0} [ <a
href="{3}">Next</a>/ <a
href="{4}">Last</a>]
</span>
yes/yes
2.5 CONFIGURATION
19
Property
Default
paging.banner.last
<span class="pagelinks">[
<a href="{1}">First</a>/
<a href="{2}">Prev</a>]
{0} [Next/Last] </span>
Valid Values
Description
yes/yes
yes/yes
yes/yes
yes/yes
paging.banner.page.separator
,
yes/yes
factory.requestHelper
RequestHelperFactory to
be used. You can replace
the default one if you
need to generate links
with a different format (for
example in portal
applications).
yes/no
paging.banner.onepage
<span
class="pagelinks">{0}</span>
paging.banner.page.selected<strong>{0}</strong>
paging.banner. page.link
org.displaytag.util.DefaultRequestHelperFactory
Class name for a valid
RequestHelperFactory
implementation
Exporting
<
%
%$ $ % 1
4
5 "# $ 5
5%5$ 5 5 5%5
1
F
%
Can be set using
file/setProperty
Property
Default
Valid Values
Description
export.types
yes/no
true, false
yes/yes
export. {export name}
true
export. {export
name}.class
yes/no
Any string
yes/yes
export. {export
name}.label
<span class="export
{export name} "> {export
name} </span>
2.5 CONFIGURATION
20
Property
Default
Valid Values
Description
export. {export
name}.include_header
false
true, false
yes/yes
yes/yes
yes/yes
yes/yes
export. {export
name}.filename
none
export.amount
list
page, list
export.decorated
true
true, false
Property
Default
Valid Values
Description
css.tr.even
even
yes/yes
yes/yes
yes/yes
yes/yes
yes/yes
yes/yes
yes/yes
css
Can be set using
file/setProperty
css.tr.odd
odd
css.th.sorted
sorted
css.th.ascending
order1
css.th.descending
order2
css.table
none
css.th.sortable
none
2.5 CONFIGURATION
21
2.6
22
Export filter
......................................................................................................................................
+
6
$
6 1 . J !
%
1
%
!
+
The solution
!
$ %
+
<%@ page buffer = "16kb" %>
<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>
23
3.1
24
Basic usage
......................................................................................................................................
!)
!
$
2
$
Basic, columns
25
%
0
. ) /$
.'''/
! )
;
3.2
26
Implicit objects
......................................................................................................................................
3.3
27
Data sources
......................................................................................................................................
Data sources
Expressions
C
$
) ! 5 5 -
7
$
!
<% request.setAttribute( "test", new TestList( 10 ) ); %>
1
0 !
$
%
$
% !
.property 0
() %
[]
1 +
sessionScope.list.value.attribute(name).item[1]
28
$
<
$
+
D/ C ! +
! -+-
<sql:query var="results">
select * from table
</sql:query>
<display:table name="${results.rows}" />
(or
<display:table name="pageScope.results.rows" />
if not using the EL version)
E/ C
+33!
3 3 3
33
3 3 341<
<%
Connection con = ...; // just open a connection
Statement stmt = con.createStatement();
ResultSet rs = stmt.executeQuery("SELECT * from table");
29
3.4 DECORATORS
3.4
30
Decorators
......................................................................................................................................
Decorators
55
!
55 !
Table decorators
A:
<
.
@
8%
/
6 9
!
6 ; <./
./
!
)
TableDecorator.getCurrentRowObject()
!$
6 7 !
. :<$ 8$ /
$ F
$
!
) $
$ !
$
'''./
3.4 DECORATORS
31
0
$
$ !
<display:table name="test">
<display:column property="id" title="ID" />
<display:column property="email" />
<display:column property="status" />
<display:column property="date" decorator="org.displaytag.sample.LongDateWrapper"
/>
</display:table>
3.5 LINKS
3.5
32
Links
......................................................................................................................................
Generating links
Smart linking of column data
C4)
. /
$
C4)
Dynamic links
%
$ % ! $
$
% .
55$
!/ 9 : %
Struts-like approach
N
. $
:<$
;$
A
$
1
/ 1
+ $
$
+
C4)
:
3.5 LINKS
33
C4)
;
C4) .
$
! ) /
A
!
C4)
1
$
B
$
;
1
)
!
<display:table name="sessionScope.details">
<display:column property="id" title="ID" href="details.jsp" paramId="id" />
<display:column property="email" href="details.jsp" paramId="action"
paramName="testparam" paramScope="request" />
<display:column property="status" href="details.jsp" paramId="id"
paramProperty="id" />
</display:table>
Using a decorator
%
$
$ :
5 5
$
%
!
!$
! ) %
9
$
!F 5:<5 !$ !F
%
(
)D./ )E./
<
3.5 LINKS
34
3.6 STYLE
3.6
35
Style
......................................................................................................................................
Style
0
%
$
0 ! +
D
E
Html attributes
1
3
Style Sheets
*
+,
*, *
,
3
0
&
$
3
&
0
+
+
class
assigned to
odd
even
sorted
order1
3.6 STYLE
36
class
assigned to
order2
sortable
3.7 EXPORT
3.7
37
Export
......................................................................................................................................
Exporting data
7
F export 55$
%
<
# %
%
1$ %$ ')
A<2 %
%
Media
Description
CSV
org.displaytag.export.CsvView
Excel
org.displaytag.export.ExcelView
XML
org.displaytag.export.XmlView
org.displaytag.export.PdfView
.
F /
3.7 EXPORT
38
%
%
+
export.[mymedia]=true
export.[mymedia].class=fully.qualified.class.name
export.[mymedia].label=Click here to try my export
# include header parameter is forwarded to your export view
export.[mymedia].include_header=true
# if set, file is downloaded instead of opened in the browser window
export.[mymedia].filename=
?
0 %
export. mymedia .label
8%
0
3.8 I18N
3.8
39
I18n
......................................................................................................................................
i18n - Internationalization
:
$
<
%
i18n for displaytag resources
7
One item found
:
column +
D
title +
E
titlekKey +
:
F
3.8 I18N
40
Advanced
<
Locale resolution
9
- . /
$
(
+
@ $ 1
+
<
LocaleResolver
displaytag.properties locale.resolver
:
- $
($
org.displaytag.localization.LocaleResolver
resolveLocale(HttpServletRequest)
<
+
class name
behaviour
org.displaytag.localization.I18nJstlAdapter
org.displaytag.localization.I18nStrutsAdapter
org.displaytag.localization.I18nWebworkAdapter
Webwork2 adapter, will look for the locale specified by the fist
LocaleProvider action in the stack
org.displaytag.localization.I18nSpringAdapter
Resources lookup
3.8 I18N
41
behaviour
org.displaytag.localization.I18nJstlAdapter
org.displaytag.localization.I18nStrutsAdapter
org.displaytag.localization.I18nWebworkAdapter
Webwork2 adapter, will look for the first TextProvider action in the
stack and will obtain a message for the given key.
org.displaytag.localization.I18nSpringAdapter
Spring adapter, will look for the configured messageSource and use
it to obtain a value for the given key.
4.1 FAQ
4.1
42
FAQ
......................................................................................................................................
D 7 :
:
) $ 4
) $
D ( :
$
J
App Servers specific problems
D
@4 ? : java.lang.NoClassDefFoundError:
org/apache/log4j/Layout
E *%
, displaytag-el.tld displaytag-12.tld
@4? 7
! @4?
General
#
7 :
:
) $ 4
) $
4.1 FAQ
43
3 3 !
:
7
J : %
.+$ +$ /
@1 A 1 )
.@1)/
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
0
! !$ !
$
: ! J
0 $ DHE
!
9
$
$
%
0
!
%$ %
4.1 FAQ
44
Rendering
4
( :
$
J
0
$ overflow: scroll
tbody C
;
3&$ :
8%
: 8%
!
%
(
%
1
@4 ? : java.lang.NoClassDefFoundError:
org/apache/log4j/Layout
4.1 FAQ
45
*%
, displaytag-el.tld displaytag-12.tld
@4? 7
! @4?
jrun.jsp.compiler.JRunTagLibraryInfo$InvalidTLDElementException: The
tag example on line 244 is not a valid TLD element at
jrun.jsp.compiler.JRunTagLibraryInfo$TLDParser.startElement(JRunTagLibraryInfo.java:61
$
@4
*%
,
http://java.sun.com/dtd/web-jsptaglibrary_1_2.dtd @4 F
%
: $
@4+
6 :
F 8) $
displaytag-el.tld
displaytag-12.tld
! DD
6 :
8) $ % displaytag-el.tld !
*%
, 4
!
7
%
@4$
%
4.2
46
Reporting bugs
......................................................................................................................................
Issue Tracking
# <
- .@:4 /
-
A
Bug reporting
9 @:4 $
+
D 4 2 Q
E 1 @:4
I
G 1
%
A
-
@:4
$
.
/
Please do not post bug reports or patches directly to the user or development mailing lists !
1 1 No, a zip file with all modified sources is not OK
E B ! $ %
% ) 3
@1A
G C
.% 3
/
: - $
:
&
I
1$
47
4.3
48
Mailing Lists
......................................................................................................................................
Mailing Lists
! 2 $ $
$
List Name
Subscribe
Unsubscribe
Archive
Subscribe
Unsubscribe
Archive
Subscribe
Subscribe
Unsubscribe
Archive
Unsubscribe
Archive
5.1
49
Source Repository
......................................................................................................................................
Web Access
+33 33 3
3
3
maven scm:checkout-project
-Dmaven.scm.method=cvs
-Dmaven.scm.cvs.module=displaytag
-Dmaven.scm.cvs.root=:pserver:anonymous@cvs.sourceforge.net:/cvsroot/displaytag
-Dmaven.scm.checkout.dir=.
maven scm:checkout-project
-Dmaven.scm.method=cvs
-Dmaven.scm.cvs.module=displaytag
-Dmaven.scm.cvs.root=:ext:username@cvs.sourceforge.net:/cvsroot/displaytag
-Dmaven.scm.checkout.dir=.
-Dmaven.scm.cvs.rsh=ssh
50
4
F F
ssh maven.scm.cvs.rsh=ssh
%
5.2
51
<
2 $
.
DH/
2
Run it!
/ $
maven
2
.
/
4 % $
$
$ . / 0 maven -g 4
maven jar
!
5.3
52
Directory Organization
......................................................................................................................................
Overview
Content
Comment
LICENSE.txt
project.xml
project.properties
maven.xml
src/
Source code
src/java
src/webapp
src/tld
tld
53
Content
Comment
xdocs/
xdocs/navigation.xml
checkstyle.xml
Directory name
Content
Comment
target/
Maven-Generated Layout
target/classes
target/generated-docs
target/docs
target/docs/index.html
target/docs/apidocs
API documentation.
54
Directory name
Content
Comment
target/docs/xref
target/docs/mail-lists.html
target/docs/team-list.html
target/docs/dependencies.html
target/docs/changelog.html
target/docs/file-activity-report.html
target/docs/developer-activity-report.html
target/docs/jdepend-report.html
Metric report.
target/docs/checkstyle-report.html
Checkstyle report.