I'm trying to show a session attribute "userSession" in a jsp page using JSP EL, but it returns null (case 1). Request attributes are shown properly in EL expressions though.
Using java scriptlet instead, behaves as shown in cases 2 and 3:
<c:out value="${userSession}"/>
\\Returns null<c:out value='<%=request.getSession().getAttribute("userSession")%>'/>
\\Works fine - returns session attribute<c:out value='<%=session.getAttribute("userSession")%>'/>
\\Throws exception: cannot find variable session
Exception of case 3 may be related to case 1 problem, something like not recognizing the session variable for some reason and that affecting the EL expression then.
I'm using Spring MVC 2.5 and JSTL 1.1.2.
I can post anything else needed to clarify the problem.
<c:out value="${userSession}"/>
: null – Fluidextract