在JSP中,如何使用JSTL检查请求中是否存在某个会话属性? [英] In JSP, how can i check, using JSTL, if certain session attribute exists in request?
本文介绍了在JSP中,如何使用JSTL检查请求中是否存在某个会话属性?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这是servlet中的代码:
This is code in servlet:
HttpSession session = request.getSession(true);
session.setAttribute("user", user);
我正在向JSP转发请求,我想检查是否附加了会话范围的用户参数。
I am forwarding request to JSP, where i want to check if there is session scoped user parameter attached.
<c:if test="${??? - check if user is attached to request}">
/ /message
</c:if>
推荐答案
<c:if test="${sessionScope.user != null}">
There is a user **attribute** in the session
</c:if>
这篇关于在JSP中,如何使用JSTL检查请求中是否存在某个会话属性?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文