Columns

ID Name Email Status Comments
5889 At Ea At-ea@eirmod.com NONUMY duo dolores...
33400 Aliquyam Magna aliquyam-magna@sanctus.com INVIDUNT vero no...
30647 Consetetur Dolores consetetur-dolores@Lorem.com VOLUPTUA diam diam...
49716 Est At est-At@gubergren.com EST est est...
39482 Sed Tempor sed-tempor@diam.com DOLOR eos voluptua...
84858 Eirmod Sadipscing eirmod-sadipscing@sit.com KASD et diam...
86746 Dolore Sit dolore-sit@sed.com ACCUSAM justo consetetur...
10246 Sadipscing Dolor sadipscing-dolor@elitr.com ET dolor tempor...
81257 Eirmod Dolores eirmod-dolores@eos.com DOLORES voluptua et...
12678 Sed Sadipscing sed-sadipscing@sed.com AMET elitr kasd...

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.