如何使用JSTL标记检查Spring mvc 3中的Session变量是否包含null或Not(How to check if a Session variable contain null or N

编程入门 行业动态 更新时间:2024-10-26 06:33:27
如何使用JSTL标记检查Spring mvc 3中的Session变量是否包含null或Not(How to check if a Session variable contain null or Not in spring mvc 3 using JSTL tag )

想要检查会话变量“Sess_Var”是否包含null

<c:if test="${Sess_Var=='NULL'}" > <% response.sendRedirect("doLogin.obj"); %>

但它不起作用,它没有检查它

Want to check that session Variable "Sess_Var" contain null or not

<c:if test="${Sess_Var=='NULL'}" > <% response.sendRedirect("doLogin.obj"); %>

But its not working,It doesnt check it

最满意答案

如果你的意思是要检查它是否为NULL(而不是检查变量是否包含字符串'NULL',那么你可以这样做

<c:if test="${empty Sess_Var}">

这将检查变量是空还是null,如果是,则计算结果为true 。

If you mean you want to check if it is NULL (as opposed to checking if the variable contain the String 'NULL' then you could do

<c:if test="${empty Sess_Var}">

This checks to see whether the variable is empty or null and evaluates to true if it is either.

更多推荐

本文发布于:2023-08-01 11:22:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1358100.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:如何使用   变量   标记   Session   mvc

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!