简体   繁体   中英

JSTL Core <c:if> not working

I'm passing a parameter page to my JSP page, now I have made an if statement on there, but it doesn't work.

<c:if var="${param.page == "course"}">class="active"</c:if>

Does somebody know what my problem is here?

The correct way to use it would be:

<c:if test="${param eq 'greetTheWorld'}">
  <p>Hello world!</p>
</c:if>

Consider it just like an if clause on programming.

if (1 < 0) {
  print("something is wrong!");
}

使用eq检查是否相等。

<c:if var="${param.page eq 'course'}">class="active"</c:if>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM