On Thu, 21 Nov 2002, Scott Goldstein wrote:

> I'm not sure that I follow.  How about these two snippets:
> 
> <%
>      String value = "foo";
> %>
> 
> <c:out value="${requestScope[value]}"/>
> 
> and
> 
> <c:out value="${requestScope["foo"]}"/>
> 
> The second one works, while the first doesn't.

Yes.  Again, this is correct.  In fact, the problem is the same:  in the
first example (which is the same as what you showed before), 'value' is
simply a scripting variable.  It is not automatically visible to the EL;
the EL has no way to read scripting variables.  Instead, it must be made a
scoped variable explicitly, as by pageContext.setAttribute().

> The only difference is that the second is using a string literal for
> the index and the first is using a scripting variable.  Are you saying
> that scripting variables cannot be used as indexes?

I'm saying that scripting variables cannot be accessed at all by the EL.
Any EL-accessible values can be used as indices.

Shawn


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

Reply via email to