jsp页面中的spring security "param.error"是什么意思?

4

请问在login.jsp页面中,参数param.errorparam.logout的变量来源在哪里?

我使用了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>
2个回答

2

您正在错误地使用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 中设置了某些东西吧?


谢谢您的回答。您能否告诉我“param”变量(属性)保存了哪些信息? - Issam EL-GUERCH
在你的某个servlet中,你正在设置一个对象类型的变量"param"。例如 -> request.setAttribute("param", paramObject); - Jonathan Laliberte
你也可以通过JSTL在.jsp文件中设置它。 - Jonathan Laliberte

0

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接