Thanks. I didn't find quite what I was looking for. I wrote a very simple solution based a little bit on OpenACS.
A request comes in like:
/student/showDetails.do
Based on this request name, the controller servlet automatically loads a class called
com.company.product.student.ShowDetails
and calls a doRequest method.
It then redirects to a JSP called (by default but can something else if necessary)
/student/showDetails.jsp
A simple DB API which automatically sets the results in the request and then allows the results to ne iterated through in the JSP in a slightly similar way to the OpenACS templating tags.
To get a minimal page up and running I do 2 things:
1. Write the business logic class with the right name:
package com.blah.student;
public class ShowDetails extends AutoRequestHandler {
public void doRequest() {
DB.dbMultirow("test", "select * from users where id < 1000", request);
}
}
2. Write the JSP called /student/ShowDetails.jsp
<%@ taglib uri="/WEB-INF/tlds/db.tld" prefix="db" %>
<db:iterator name="test">
<br><db:data name="email" />
</db:iterator>
where "email" is a column name returned in the query.
It is also possible to have conditionals on the rownum or on the data
like <db:if test="rownum odd" />
or <db:if test "student_number eq 234" />
<%@ taglib uri="/WEB-INF/tlds/db.tld" prefix="db" %>
<table>
<db:iterator name="test">
<tr>
<db:if test="rownum odd" />
<td bgcolor="#003333">
</db:if>
<db:else>
<td bgcolor="#006666">
</db:else>
<br><db:data name="email" />
</td>
</tr>
</db:iterator>
</table>
Sorry to post here - it's only marginally OpenACS related. If anyone is interested in this or wants to tell me I'm waisting my time because there already exists such a solution then please email me.