>>>>> "Julia" == Julia A Case <[EMAIL PROTECTED]> writes:

    Julia> I'm trying to use foreach in the following way
    Julia> <c:forEach var="genre" items="<%= utilBean.getGenres() %>">
    Julia>   <jsp:useBean id="genre" type="String"/>
    Julia>   <%= genre %>
    Julia> </c:forEach>

    Julia> getGenres() returns an array of Strings

    Julia> The same logic works both above and below with other functions.  But
    Julia> this one keeps telling me bean genre not found in scope.  Looking at the
    Julia> java code that is created from the jsp it looks like it tests for a null
    Julia> and generates that message, but if I simply replace the <jsp:useBean and
    Julia> the next line with some sort of string to print it prints the correct
    Julia> number of times, so I know it's getting the array.

I would assume you're using the "-rt" library, if your loop iterated the
correct number of times.

I believe that, even in the "-rt" library, that the JSTL does not create
scripting variables, just scoped variables in the application, session,
request, or page.

If you want to print out the value of the string, then just do this:

 <c:forEach var="genre" items="<%= utilBean.getGenres() %>">
  <c:out value="${genre}"/>
 </c:forEach>

Even better, if you use the non-rt library:

 <c:forEach var="genre" items="${utilBean.genres}">
  <c:out value="${genre}"/>
 </c:forEach>

-- 
===================================================================
David M. Karr          ; Java/J2EE/XML/Unix/C++
[EMAIL PROTECTED]


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

Reply via email to