Thanks a lot Kris. Now I will use JSTL only.

Antony Paul
----- Original Message -----
From: "Kris Schneider" <[EMAIL PROTECTED]>
To: "Tag Libraries Users List" <[EMAIL PROTECTED]>
Sent: Friday, December 05, 2003 10:24 PM
Subject: Re: Calling a bean method in <c:out/>


> Coming in late, but personally, I'd skip the whole RowSetDynaClass thing
and use
> what JSTL already gives you:
>
> 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);
> ...
>
> The Result interface is much more JSTL-friendly than DynaBean (which
doesn't
> implement or expose Map).
>
> Quoting Martin van Dijken <[EMAIL PROTECTED]>:
>
> > Hey Antony,
> >
> > You've got it wrong there. The solution for your simple example is this:
> >
> > <%@ page import="java.util.*"%>
> > <%@ taglib uri="/WEB-INF/c.tld" prefix="c"%>
> > Sample using JSTL Core tags<br>
> > <%
> >   Map map = new HashMap();
> >   map.put("name","Anto Paul");
> >   map.put("Place","Ollur");
> >   map.put("Job","Programmer");
> >   request.setAttribute("list",map);
> > %>
> > <c:forEach var="i" items="${list}">
> >    <c:out value="${i.key}:${i.value}"/><br>
> > </c:forEach>
> >
> > This will print a name:AntoPaul<br>Place:Ollur<br> etc. To get back to
> > your original question, this might be solved if your DynaBeans are
> > instances of Map in the following way:
> >
> > Servlet:
> > List list = rsdc.getRows();
> > request.setAttribute("list",list);
> >
> > JSP:
> > <c:forEach var="i" items="${list}">
> >    <c:out value='${i["empno"]}'/>
> > </c:forEach>
> >
> > Lucky I had a few minutes to spare;) I usually just scream "read the
> > spec":)
> >
> > Martin
>
> --
> 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]
>
>

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

Reply via email to