On Fri, 14 Mar 2003, Paul Pattison wrote:

> Date: Fri, 14 Mar 2003 12:28:04 -0500
> From: Paul Pattison <[EMAIL PROTECTED]>
> Reply-To: Struts Users Mailing List <[EMAIL PROTECTED]>
> To: Struts Users Mailing List <[EMAIL PROTECTED]>
> Subject: RE: Data driven struts application
>
> An approach that I've used is to use the javax.servlet.jsp.jstl.sql
> ResultSupport and Result objects.  I create a Result object from the
> ResultSet object in this line:
>
>     lResult = ResultSupport.toResult(lResultSet);
>
> I then pass the Result to the jsp:
>
>     aRequest.setAttribute("departments", lResult);
>
> And display it using the jstl taqs as follows:
>
>     <c:forEach var="department" begin="0" items="${departments.rows}">
>       <department>
>         <name><c:out value="${department.name}"/></name>
>         <description><c:out
> value="${department.description}"/></description>
>         <phone><c:out value="${department.phone}"/></phone>
>         <fax><c:out value="${department.fax}"/></fax>
>       </department>
>     </c:forEach>
>
> This allows me to close the Connection and keep the data alive (I
> think), so is this a good approach?
>

Yep ... it has the same benefit as RowSetDynaClass does (as long as you're
running on a Servlet 2.3 / JSP 1.2 platform that JSTL required), plus it's
easier to use JSTL tags (or EL expressions in JSP 2.0) to access the
properties.

> Paul

Craig

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to