On Thu, 21 Nov 2002, Scott Goldstein wrote:

> I think this may have already been posted, but I don't recall the
> answer.
> 
> Aren't the following two snippets identical?
> 
> <%
>     String value = "foo";
> %>
> 
> <c:out value="${requestScope[value]}"/>
> 
> and
> 
> <%= request.getAttribute(value) %>

Nope.  Scripting variables are not automatically made into scoped
attributes, and the EL can only refer to scoped attributes.  If you added

  pageContext.setAttribute("foo", foo);

to the upper scriptlet, then the code would be identical.

> The first is returning null and the second is returning the
> appropriate attribute value.  I looked in the JSTL spec and it looks
> like the first should work.
> 
> Is this a bug?

No, the behavior is as expected.

-- 
Shawn Bayern
"JSTL in Action"   http://www.manning.com/bayern


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

Reply via email to