An object doesn't have to be serializable to be stored in a request attribute. The HttpServletRequest object and its attributes live in memory.
And displaytag uses a collection (a List, most of the time) of objects which should respect JavaBeans conventions.
So the process is simple:
- The servlet executes a database query
- It iterates through the ResultSet, and creates a
List<Foo>
containing the data retrived by the query
- It stored this list as an attribute of the request:
request.setAttribute("foos", fooList);
- It forwards the request and response to the JSP, using the RequestDispatcher
- The JSP uses the displaytag to display the content of the
${foos}
as a table.
If you have to transfer two resultsets, execute 2 requests, build two lists, store them in 2 request attributes, and use the displaytag twice in the JSP.