You are viewing a plain text version of this content. The canonical link for it is here.
Posted to taglibs-user@tomcat.apache.org by Hans Bergsten <ha...@gefionsoftware.com> on 2002/09/19 20:07:40 UTC

Re: Is it possible to reference scriptlet variables from a JSTL tag?

Richard Berger wrote:
> For example...
> <jsp:useBean id="delegate" scope="page" class="golf.util.ResourceDelegate"/>
> ....
> <% Collection coll = delegate.getReservationsForUserID(userid); %>
> <c:forEach items="${coll}" var="teeTime">
> 
> I do not seem to be able to get this to work.  Am I missing something, or do
> I need to do this all in scriptlet world and forget about JSTL for this
> problem?

JSTL actions (or any other custom action) have no way to access
scripting variables, only "scoped variables". A scoped variable is the
same as an object stored as an attribute of any of the JSP scopes: page,
request, session and application. So you need to modify your code
like this:

   <%
     Collection coll = delegate.getReservationsForUserID(userid);
     pageContext.setAttribute("col1", col1);
   %>
   <c:forEach items="${coll}" var="teeTime">

Hans
-- 
Hans Bergsten		hans@gefionsoftware.com
Gefion Software		http://www.gefionsoftware.com
JavaServer Pages	http://TheJSPBook.com


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>