View source
ID Name Email Status Comments
1834 Sanctus Justo sanctus-justo@sed.com ALIQUYAM magna consetetur...
3663 Sed Justo sed-justo@justo.com SED justo rebum...
87826 Eos Dolores eos-dolores@labore.com GUBERGREN et labore...
31037 Tempor Labore tempor-labore@et.com SIT tempor Lorem...
83001 Et Eirmod et-eirmod@duo.com CONSETETUR vero magna...
12930 Sea Sed sea-sed@sit.com CONSETETUR erat ipsum...
28787 Magna Sanctus magna-sanctus@erat.com NONUMY est nonumy...
23080 Gubergren Nonumy gubergren-nonumy@Stet.com NO sed rebum...
59435 Sanctus Lorem sanctus-Lorem@sed.com NONUMY sea tempor...
60090 Diam Labore diam-labore@kasd.com MAGNA justo no...

This example starts to show you how to use the table tag. You point the table tag at a datasource (a List), then define a number of columns with properties that map to accessor methods (getXXX) for each object in the List.

Note that you have one column tag for every column that you want to appear in the table. And, the column specifies what property is shown in that particular row.

You can define the content of a column by adding a property attribute to the column tag or adding a content to the tag.

  • <display:column property="email" />
  • <display:column title="email">email@it.com</display:column>

There are two ways to define the content of a column. Of course, in the tag body you can use scriptlets or other custom tags. Using the property attribute to define the content of a column is usually faster and works better with sorting. If you add a property attribute the tag body is ignored.

The property attribute specifies what getXXX method is called on each item in the list. So for the second column, getName is called. By default the property name is used as the header of the column unless you explicitly give the column a title.