The value for 'email' is set within session scope using
session.setAttribute("email", "[email protected]").
To display the value later, the following code was used
<c:out value='${session.getAttribute("email")}'> </c:out>
This yielded no output on the screen. Note that the necessary packages were imported and that there is no error produced.
However, if I re-write using the scriptlet: <% out.print(session.getAttribute("email")); %>
, I get my desired output.
Why doesn't session.getAttribute()
work when using the EL expression?
The correct way of fetching a session attribute in a jsp via EL is
You are messing up the JSTL & scriptlet code, you can try