Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jstl: access session variable

Tags:

jsp

session

jstl

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?

like image 544
Cacheing Avatar asked May 25 '26 21:05

Cacheing


1 Answers

On your JSP page use -

Username : ${sessionScope.user}
like image 51
Maverick Avatar answered May 28 '26 18:05

Maverick



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!