JSTL and EL together provide an easy way to access session, request and application scope variables. EL provides implicit variables like sessionScope, requestScope, applicationScope and many more which are actually Map type. They can be navigated easily by using dot operator to access any attributes added to it.
Below JSP code provides a simple way of accessing and displaying the values.
Note that we have added the scriptlet in the page, just to show that we are adding value in session and request variables. Scriptlets should be avoided when JSTL and EL are used.
<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
<% //Scriptlets are not to be used
request.setAttribute("param1", "Hello JSTL World!");
session.setAttribute("userName", "Generic User");
%>
Hello <c:out value="${sessionScope.userName}"/>,</p>
Welcome to <c:out value="${requestScope.param1}"/></p>
It provides a output as below:
Hello Generic User,
Welcome to Hello JSTL World!