Prev Next

Web / JSP interview questions

How do I access session scoped attributes in JSP?

Using the below scriptlet in JSP, the session attributes can be accessed.

<%=request.getSession().getAttribute("sessionVariable")%>

Also the session attributes could be accessed using JSTL and Expression Language tag as shown below.

<c:out value="${sessionScope.sessionVarible}"/>

or using,

<c:out value="${sessionScope['sessionVariable']}"/>

More Related questions...

Show more question and Answers...


Comments & Discussions