Cacheing
Cacheing

Reputation: 3471

jstl: access session variable

In the servlet, I set session value

HttpSession session = httpRequest.getSession();
session.setAttribute("user", "adam");

Then, on the JSP page, when I try to get the value <c:out value="${user}"></c:out>, I got the error According to TLD or attribute directive in tag file, attribute value does not accept any expressions

Then how can I get the session variable?

Upvotes: 3

Views: 17130

Answers (1)

Maverick
Maverick

Reputation: 292

On your JSP page use -

Username : ${sessionScope.user}

Upvotes: 5

Related Questions