I want to display the value of a cookie on a JSP page. Using EL, I crafted this:
<c:set var="errorFlash" value="${cookie['error']}"/>
<c:if test="${null != errorFlash}">
<p>${fn:escapeXml(errorFlash.value)}</p>
</c:if>
This seems to work, but I am not sure if this would decode special URL characters in the cookie value correctly. I did a quick test using curl like this:
$ curl http://localhost:8080/login -v -b 'error=Hello%20World'
[...]
> Cookie: error=Hello%20World
[...]
<p>Hello%20World</p>
[...]
So it does not seem to decode the %20 character sequence correctly. However, this might be an issue with curl, not with my Tomcat instance. Here's another take:
$ curl http://localhost:8080/login -v -b 'error=Hello World'
[...]
> Cookie: error=Hello World
[...]
<p>Hello</p>
[...]
What am I doing wrong?