spring jsp 页面中的 "param.error" 安全性?

spring security "param.error" in jsp page?

能否解释一下 login.jsp 中的参数 param.errorparam.logout 变量来自哪里?

我已将 spring 安全性与 spring boot

一起使用
<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 适用于空变量和 null 变量。

回答您的问题...如果不显示任何更多代码,则不可能知道您的变量来自何处。您肯定在您的 servlet 中设置了一些东西吗?

如果您在实施中使用 Spring 安全登录,那么这可能就是 param.errorparam.logout 的来源。

更详细的解释请看-https://www.baeldung.com/registration-verify-user-by-email