Acquiring your List of data

Up until this point, we have simply had a List object available to us under the name "list" in the request scope that has driven the display of the tables shown. We have been setting up that bean with the following scriptlet, but presumably you would be doing something similar in your Action class rather then raw on this jsp page.

<% request.setAttribute( "test", new TestList( 10 ) ); %>

This table is called with the following attributes:

<display:table name="test">
ID Name Email Status Comments
5569 Eirmod Rebum eirmod-rebum@dolores.com ET diam diam...
44418 Labore Magna labore-magna@Stet.com ACCUSAM invidunt et...
38185 Labore Takimata labore-takimata@justo.com SANCTUS kasd vero...
9501 Eos Amet eos-amet@ut.com ET labore dolor...
99917 Dolores Sadipscing dolores-sadipscing@est.com LOREM et sadipscing...
73191 Dolores Sanctus dolores-sanctus@clita.com VERO invidunt gubergren...
62120 Dolor Kasd dolor-kasd@At.com ALIQUYAM duo justo...
4973 Et Aliquyam et-aliquyam@et.com IPSUM no tempor...
45095 Justo Aliquyam justo-aliquyam@et.com DUO amet dolore...
39454 Duo Accusam duo-accusam@tempor.com SADIPSCING est diam...

But, like other struts tags, you can acquire a handle to the list you want to display by specifying not only a bean name, but also a bean property (a getter method), and the table tag will call that property to fetch the list to display.

The value of the name attribute can be expressed with a syntax similar to EL of JSTL.

You can define the scope of the bean adding one of the following suffix:

  • pageScope
  • requestScope (default)
  • sessionScope
  • applicationScope

You can also access javabean style properties, mapped properties or indexed properties in the bean, also nested!. The syntax for accessing a javabean property is .property. You can read a mapped property specifying it between () and an indexed property using [].

So the following:

sessionScope.list.value.attribute(name).item[1]

is equivalent to:

session.getAttribute("list").getValue().getAttribute("name").getItem(1)

The lists above and below are both generated randomly each time you come to this page, but since this list of data is attached to your session, it should remain the same through page refreshes.

This table is called with the following attributes:

<display:table name="sessionScope.holder.list">
ID Name Email Status Comments
17932 Nonumy Et nonumy-et@sanctus.com DIAM diam labore...
37071 Magna Vero magna-vero@ea.com SEA magna sed...
44517 Sanctus Sit sanctus-sit@est.com JUSTO ut no...
77533 Et Rebum et-rebum@elitr.com SED duo et...
46845 Et Sea et-sea@est.com DOLOR diam justo...
5915 Invidunt Duo invidunt-duo@consetetur.com INVIDUNT est justo...
53694 Sed Diam sed-diam@voluptua.com ET et est...
56137 Stet Aliquyam Stet-aliquyam@labore.com TAKIMATA et accusam...
19194 Et Takimata et-takimata@diam.com DIAM elitr elitr...
2260 Sed Erat sed-erat@vero.com ALIQUYAM dolores elitr...
4803 Et Consetetur et-consetetur@no.com EA invidunt amet...
1636 Dolores Sit dolores-sit@Lorem.com EA sed et...
49522 Erat Duo erat-duo@clita.com VOLUPTUA aliquyam Stet...
45125 Et Sanctus et-sanctus@sanctus.com ACCUSAM est magna...
1558 Ut Duo ut-duo@kasd.com DOLORES At no...

By default, if you supply the table tag with either a null object, or an empty list, it won't generate any tables at all, but it will display a message says "Nothing found to display"..

You can override this message using a <setProperty> tag or a custom properties file. See Config, overriding default behaviors/messages page.

Nothing found to display.