![](/img/trans.png)
[英]JSTL <c:if> tag - Checking whether Java Bean method returns True
[英]JSTL if tag always execute as true
我正在使用JSTL,並嘗試實現if
標簽
以下是我的文件login.tag
代碼
<c:if test="${not empty param.error}">
//do something
</c:if>
我的理解是當我訪問此頁面時
with path/index.jsp //the if tag is not executed
with path/index.jsp?error=wrongpassword //the if tag is executed
但是我現在得到的是if
標記始終執行true
,請指教
如果要使用c:if
標記,則應對JSTL核心標記庫使用JSP taglib指令。 在JSP頂部使用以下代碼
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
您還需要JSTL庫作為項目的依賴項。 查看此答案以查找Maven依賴項。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.