search

Home  >  Q&A  >  body text

java - jsp同时满足两个条件<c:when test="${!empty webUser&&page_name != 'main'}"

这样写语法对吗?测试没通过,那该怎么写呢?

天蓬老师天蓬老师2770 days ago1031

reply all(4)I'll reply

  • 迷茫

    迷茫2017-04-18 09:52:47

    There is nothing wrong with the expression, but there may be something wrong with the value.

    reply
    0
  • 天蓬老师

    天蓬老师2017-04-18 09:52:47

    <c:when test="${!empty webUser}"><c:if test="${page_name ne 'main'}">.....</c:if></c:when>
    可以将它分开写

    reply
    0
  • 高洛峰

    高洛峰2017-04-18 09:52:47

    It seems that c:when these are used together in a set
    For example:
    `<c:choose>

           <c:when test=条件>内容</c:when>
          <c:when test=条件>内容</c:when>
         <c:otherwise>内容</c:otherwise>

    </c:choose>`
    is if...else if...else if...else

    If it is just a judgment, just use <c:if test=condition>content</c:if>

    Use as needed

    reply
    0
  • 高洛峰

    高洛峰2017-04-18 09:52:47

    Try splitting it into two ifs

    reply
    0
  • Cancelreply