How to access at request attributes in JSP?

Martin picture Martin · Feb 6, 2011 · Viewed 128.1k times · Source

Currently I use:

<%
final String message = (String) request.getAttribute ("Error_Message");
%>

and then

<%= message %>

However I wonder if the same can be done with EL or JSTL instead of using a scriptlet.

Answer

Christoph Seibert picture Christoph Seibert · Feb 6, 2011

EL expression:

${requestScope.Error_Message}

There are several implicit objects in JSP EL. See Expression Language under the "Implicit Objects" heading.