Session Tracking Code in JSP
An equivalent action in JSP:
<jsp:useBean id=“dbs” class=“DBSessionBean” scope=“session”>
<% session.setMaxInactiveInterval(300) ; %>
</jsp:useBean>
Recall the jsp:useBean element first looks for an existing Bean of the specified name in the specified scope.
With session scope, it implicitly looks in the HttpSession object for an attribute of this name.
If the action doesn’t find an existing Bean, it creates a new one using the standard, no-argument Bean constructor.
The JSP statements in the body of the jsp:useBean element are evaluated only if a new Bean was created.
Thus this JSP element exactly reproduces the servlet code.