如何将字符串与JSTL进行比较?

时间:2014-12-08 10:29:19

标签: string jsp jstl

正如我在这个问题的标题中提到的,我想比较jsp文件中的两个字符串,但结果看起来不太好。 我实施了

<c:when test="${userProduct.term.label == 'tháng'}">
        123
</c:when>
<c:when test="${userProduct.term.label}.equals('tháng')">
    456
</c:when>

当运行上述两种方式时,我没有任何好结果,并收到以下错误消息:

/jsp/user.page.top.product.jsp(59,8) PWC6038: "${userProduct.term.label == 'tháng'" contains invalid expression(s): javax.el.ELException: Error Parsing: ${userProduct.term.label == 'tháng'
Caused by:

org.apache.jasper.JasperException: /jsp/user.page.top.product.jsp(59,8) PWC6038: "${userProduct.term.label == 'tháng'" contains invalid expression(s): javax.el.ELException: Error Parsing: ${userProduct.term.label == 'tháng'
    at org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:78)
    at org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:373)
    at org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:185)
    at org.apache.jasper.compiler.JspUtil.validateExpressions(JspUtil.java:649)
    at org.apache.jasper.compiler.Validator$ValidateVisitor.getJspAttribute(Validator.java:1357)
    at org.apache.jasper.compiler.Validator$ValidateVisitor.checkXmlAttributes(Validator.java:1133)
    at org.apache.jasper.compiler.Validator$ValidateVisitor.visit(Validator.java:850)
    at org.apache.jasper.compiler.Node$CustomTag.accept(Node.java:1501)

0 个答案:

没有答案
相关问题