简体   繁体   English

如果字符串不相等,我如何比较?

[英]How do I compare if a string is not equal to?

I'm trying to only show something based on if a string is not equal to: 我试图只根据字符串是否不等于显示某些内容:

<c:if test="${content.getContentType().getName() != "MCE"}">
<li><a href="#publish-history" id="publishHistoryTab">Publish History</a></li>
</c:if>

It keeps throwing the error org.apache.jasper.JasperException: /WEB-INF/jsp/content/manage.jsp(14,60) PWC6212: equal symbol expected 它不断抛出错误org.apache.jasper.JasperException: /WEB-INF/jsp/content/manage.jsp(14,60) PWC6212: equal symbol expected

I've also tried not eq instead of != 我也尝试过not eq而不是!=

What is the valid syntax for not equal to ? 什么是not equal to的有效语法?

Either != or ne will work , but you need to get the accessor syntax and nested quotes sorted out. 要么!=ne都可以工作 ,但是您需要获取访问器语法和嵌套引号

<c:if test="${content.contentType.name ne 'MCE'}">
    <%-- snip --%>
</c:if>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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