你能解释一下参数param.error
在哪里吗?和 param.logout
变量来自 login.jsp
?
我在 spring boot 中使用了 spring security
<c:if test="${param.error != null}">
<div class="alert alert-danger">
Invalid username and password.
</div>
</c:if>
<c:if test="${param.logout != null}">
<div class="alert alert-success">
You have been logged out successfully.
</div>
</c:if>
最佳答案
您错误地使用了 JSTL。 "!="不起作用。如果你想做一个不等于条件,你必须使用“ ne ”关键字。像这样:
<c:if test="${param.x ne param.y}">
但就您而言,您正在寻找的是:
<c:if test="${not empty param.logout}">
<c:if test="${not empty param.error}">
not empty 适用于空变量和空变量。
回答你的问题......如果不显示更多代码,就不可能知道你的变量来自哪里。你肯定在你的 servlet 中设置了一些东西?
关于jsp页面中的spring security "param.error"?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45991893/