Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to access at request attributes in JSP?

Tags:

jsp

jstl

el

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.

like image 410
Martin Avatar asked Feb 06 '11 10:02

Martin


People also ask

What is request attribute?

Request attributes are essentially key/value pairs that are associated with a particular service request. For example, if you have a travel website that tracks the destinations of each of your customers' bookings, you can set up a destination attribute for each service request.

What is the use of request in JSP?

Each time a client requests a page, the JSP engine creates a new object to represent that request. The request object provides methods to get HTTP header information including form data, cookies, HTTP methods, etc.


1 Answers

EL expression:

${requestScope.Error_Message} 

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

like image 182
Christoph Seibert Avatar answered Sep 21 '22 08:09

Christoph Seibert