Columns

ID Name Email Status Comments
59508 Erat Aliquyam erat-aliquyam@consetetur.com EIRMOD no et...
24394 Duo Elitr duo-elitr@ut.com GUBERGREN nonumy elitr...
99098 Diam Voluptua diam-voluptua@clita.com VOLUPTUA ipsum ipsum...
14009 Vero Diam vero-diam@clita.com TAKIMATA et voluptua...
41979 Sadipscing Et sadipscing-et@diam.com SANCTUS labore kasd...
2748 Erat Sed erat-sed@dolor.com DUO dolore sadipscing...
69545 Voluptua Gubergren voluptua-gubergren@sed.com NONUMY ea Lorem...
32834 Magna Et magna-et@amet.com IPSUM invidunt dolore...
16955 Dolor Sea dolor-sea@vero.com ET et clita...
69763 Diam Dolor diam-dolor@consetetur.com ET est tempor...

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.