I guess my previous example wasn't clearly formatted, but it certainly wasn't supposed to illustrate executing a query from a JSP. Here's a modified example:
Java (e.g. an action): ---------------------- import javax.servlet.jsp.jstl.sql.Result; import javax.servlet.jsp.jstl.sql.ResultSupport; ... ResultSet rs = ...; Result result = ResultSupport.toResult(rs); request.setAttribute("result", result); ... JSP: ---- <c:forEach var="row" items="${result.rows}"> <tr> <td><c:out value="${row.seq}"/></td> <td><c:out value="${row.name}"/></td> </tr> </c:forEach> Quoting jack beany <[EMAIL PROTECTED]>: > >From: Kris Schneider <[EMAIL PROTECTED]> > >Didn't like the JSTL Result suggestion, I guess ;-). As a JavaBean, > > Well personally I have no preference, just want something that works > efficiently and cleanly :) > The example you have had the query in the jsp, wheras I'm trying to stay > away from anything like that, and keep it MVC2 as possible! Using the > lovely new RowSetDynaClass I've been trying to do something that really > should be very simple, but I guess it's just not a very mature technology > yet :-/ > > >BasicDynaBean only exposes two properties: "dynaClass" and "class" (both > >are > >read-only). So, that's all JSTL can get out of a BasicDynaBean instance. > >The > >Struts tags, on the other hand, leverage BeanUtils/PropertyUtils so > they're > >perfectly capable of dealing with DynaBean properties. This is the Struts > >equivalent to your JSTL snippet, but it'll actually work if "person" is a > >DynaBean: > > > ><bean:define id="seq" name="person" property="seq"/> > > Well that worked just lovely. It's not going to be incredibly efficient > when I want to return 10 columns per row I'm sure, but nevermind! Perhaps > in 1.2 (due sometime in 2006 ;) we'll get a map property to query. > > Thanks Kris! > > J -- Kris Schneider <mailto:[EMAIL PROTECTED]> D.O.Tech <http://www.dotech.com/> --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]