You can use JSTL <c:set>
and <c:remove>
to manage session attributes.
The following does effectively a session.setAttribute("foo", "bar")
:
<c:set var="foo" value="bar" scope="session" />
And the following does effectively a session.removeAttribute("foo")
:
<c:remove var="foo" scope="session" />
Of course, you can use the usual EL way of accessing attributes, the following prints session.getAttribute("foo")
.
${foo}
Unrelated to the concrete problem, you should work on your aversion against servlets. This is not a good practice. JSTL doesn't offer everything making business logic a breeze, which would force you to fall back to legacy scriptlets. I hope that it's just ignorance. Carefully read our servlets wiki page to learn how it can easily be created and used: https://stackoverflow.com/tags/servlets/info Also this answer might be somewhat enlightening: How to avoid Java code in JSP files?