Hi all,
I am trying to do something as simple as writing a FOR loop with some information that I have in a bean, but this is proving to be quite a bit more cumbersome and difficult than I thought it would be. For some reason, everything I try seems to fail. Here is a short example of what I'm trying to do:
<% for(int i = 0; i < ${productData.someCount}; i++) { %> // Write my text here <% } %>
What am I missing here? If you could help me I'd appreciate it -- enough time wasted on this thing already.
Is it that you are trying to use the JSTL-EL inside a scriptlet? I don't think that works. How about this:
<%
MyType productData = (MyType) request.getAttribute("productData");
for(int i = 0; i < productData.getSomeCount(); i++) { %> // Write my text here <% } %>
This also defines a page scoped variable named productData. JSTL expressions go through a process of resolving names in several scopes but scriptlets don't; scriptlets only recognize variables which have been defined within their scope.
You're probably better off using the JSTL forEach tag, if you can expose a property on productData which returns an array, collection, or iterator.
Joe
--
Joe Germuska [EMAIL PROTECTED] http://blog.germuska.com "Imagine if every Thursday your shoes exploded if you tied them the usual way. This happens to us all the time with computers, and nobody thinks of complaining."
-- Jef Raskin
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]