-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On 8/12/2010 9:25 AM, Thomas Treitlinger wrote:
> Hello,
>
> I have a number of JSP pages which use the JSTL core library to set a
> request attribute like this:
> <c:set var="foo" scope="request" >FOO-VALUE</c:set>
>
> The JSPs then forward to a Servlet like this:
> <jsp:forward page="/request.go" />
>
> The Servlet later invokes
> String s = (String) request.getAttribute("foo")
>
> At this point I would expect s to be "FOO-VALUE". However after
> running without any problem for days, request.getAttribute("foo")
> suddenly starts returning NULL, causing NullPointerExceptions later
> on.
Weird. I observe the opposite effect:
- ---------------
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<c:set var="foo" scope="request" >FOO-VALUE</c:set>
<p>
Using JSTL: <c:out value="${foo}" />
</p>
<p>
Direct-to-request using JSTL: <c:out value="${requestScope.foo}" />
</p>
<p>
Using direct request fetch <%= request.getAttribute("foo") %>
</p>
- ------------
The above emits the following for me:
- ---------------
Using JSTL: ${foo}
Direct-to-request using JSTL: ${requestScope.foo}
Using direct request fetch FOO-VALUE
- ---------------
Can you get the JSTL to print your values using <c:out>?
- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iEYEARECAAYFAkxkQx8ACgkQ9CaO5/Lv0PDmUACgmxXg1ELeXAS3gH4L75YyQ2tP
u6cAn1ctYpbe6cAnfB3pIe7lry90b6Hm
=54lm
-----END PGP SIGNATURE-----
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]