Update Session Date using JSTL : Session « JSTL « Java Tutorial






<%@page contentType="text/html"%>
<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jstl/fmt" prefix="fmt" %>
<html>
<head><title>View Session JSP </title></head>
<body>
<h2>Session Info From A JSP</h2>
The session id: <c:out value="${pageContext.session.id}"/>
<h3>Session date values formatted as Dates</h3>
<jsp:useBean id="timeValues" class="java.util.Date"/>
<c:set target="${timeValues}" value="${pageContext.session.creationTime}" property="time"/>
The creation time: <fmt:formatDate value="${timeValues}" type="both" dateStyle="medium" /><br><br>
<c:set target="${timeValues}" value="${pageContext.session.lastAccessedTime}" property="time"/>
The last accessed time:  <fmt:formatDate value="${timeValues}" type="both" dateStyle="short" />
<c:out value="${timeValues}"/>
</body>
</html>
  Download:  JSTLUpdateSessionDate.zip( 938 k)








24.29.Session
24.29.1.Use JSTL to Deal with Session
24.29.2.Get HTTP Session by using JSTL
24.29.3.View Session Date using JSTL
24.29.4.Update Session Date using JSTL
24.29.5.Set Variable Scope to Session
24.29.6.Remove Attribute From Session