Columns

ID Name Email Status Comments
68188 Dolor Justo dolor-justo@et.com EA diam eirmod...
40463 Gubergren Voluptua gubergren-voluptua@est.com TEMPOR eirmod amet...
25904 Dolores Sadipscing dolores-sadipscing@gubergren.com MAGNA sed dolore...
13807 At Nonumy At-nonumy@Stet.com MAGNA Stet rebum...
18675 Tempor Duo tempor-duo@diam.com SADIPSCING dolor sadipscing...
93379 Vero Labore vero-labore@aliquyam.com CONSETETUR voluptua accusam...
29764 Voluptua Nonumy voluptua-nonumy@At.com JUSTO dolor dolor...
47987 Elitr Dolores elitr-dolores@et.com ET nonumy ipsum...
60521 Et Diam et-diam@et.com EA diam diam...
60180 At Dolor At-dolor@sadipscing.com VOLUPTUA duo diam...

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.