jprusakova
jprusakova

Reputation: 1657

Need to access session-timeout value in JSP

I have a standard Tomcat/Spring application, with session timeout configured in web.xml :

<session-config>
<session-timeout>15</session-timeout>
</session-config>

I need to access the timeout setting in a JSP:

Properties.prototype.setProperty({ 
    'sessionTimeOut' : "<c:out value='${session.sessionTimeOutInterval}'/>",
});

Any ideas on how to do that? It is possible to add a filter that sets session timeout interval as an attribute:

session.setAttribute("sessionTimeOutInterval", session.getMaxInactiveInterval()); 

But I'd rather avoid adding a filter.

What would be a better way of making this value available in the JSP?

Upvotes: 1

Views: 1253

Answers (1)

rickz
rickz

Reputation: 4474

Here is one way.

${pageContext.session.maxInactiveInterval}

Upvotes: 1

Related Questions