JSTL: set attributes : Session « JSTL « Java






JSTL: set attributes

<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>

<html>
  <body>
    This JSP stores the 'para' in a session-scoped variable where
    the other JSPs in the web application can access it.
    <p />
    <c:set var="para" value="${41+1}" scope="session"  />

     Click <a href="displayAttributes.jsp">here</a> to view it.
  </body>
</html>

//displayAttributes.jsp

<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>

<html>
  <head>
    <title>Retrieval of attributes</title>
  </head>
  <body>
    The para is <c:out value="${sessionScope.para}" /> <br/>
  </body>
</html>


           
       








Related examples in the same category

1.JSTL: Remove the attributes