0

As I mentioned in the title of this question, I want to compare two strings in jsp file but the result doesn't look good. I implemented a

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

When running the two ways above, I don't have any good result and I received following error message:

/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)
user3737020
  • 514
  • 11
  • 27
  • You should eventually look at [this other question](http://stackoverflow.com/q/13570298/3545273) to be sure that you really need a `when` and not a `if` (as you did not show an enclosing `c:choose`) – Serge Ballesta Dec 08 '14 at 10:41
  • your first "when" is laking a } in the end. – Angelo Fuchs Dec 08 '14 at 10:59

0 Answers0