Thursday, July 29, 2004

Java Standard Tag Libray

Today I have been re-writing my big domino web application. This app uses a lot of views to create statistical data for the end users. I have kind of replicated this in a j2EE stylee by creating a table full of select statements:



The app then picks the right view by via a URL like like:

http://localhost:8080/sampler/displayReport.do?name=SITBYTEAM

This gets executed and the results stuffed in a Data Transfer Object and pushed back into a jsp page (which is kind of acting like a $$defaultviewtemplate).

In the JSP I use the rather nobby Java Standard Tag library to chuck the view on the page:


<table>
<tr>
<c:forEach var="colName" items="${reportDTO.columnNames}">
<th><c:out value="${colName}"/></th>
</c:forEach>
</tr>
<c:forEach var="row" items="${reportDTO.rows}" varStatus="lineNo">
<tr class="AltTable<c:out value="${lineNo.index % 2}"/>">
<c:forEach var="col" items="${row}">
<td><c:out value="${col}"/></td>
</c:forEach>
</tr>
</c:forEach>
</table>


This is kind of fab as it avoids all the nastty scritplet cobblers which are so frowned upon.

So now if want to do a new view I just create a new view record with some SQL in it, give it a name like BORINGTHEBOLLOCKSOFUS and whack a url on a page like

http://localhost:8080/sampler/displayReport.do?name=BORINGTHEBOLLOCKSOFUS

and Bob is your aunties live in lover.




0 Comments:

Post a Comment

<< Home

This page is powered by Blogger. Isn't yours?