<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
<html>
<body>
This JSP stores the ultimate answer in a session-scoped variable where
the other JSPs in the web application can access it.
<p />
<c:set var="theUltimateAnswer" value="${41+1}" scope="session" />
Click <a href="displayAttributes.jsp">here</a> to view it.
</body>
</html>
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
<html>
<head>
<title>Retrieval of attributes</title>
</head>
<body>
The ultimate answer is <c:out value="${sessionScope.theUltimateAnswer}" /> <br/>
</body>
</html>
Download: JSTlSetVariableAsSessionScope.zip( 1,022 k)