Announcement Announcement Module
Collapse
No announcement yet.
Jstl c:set question Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Jstl c:set question

    I am using spring bind tags for the first time and I am setting a variable with jstl within the bind tags as follows:

    <spring:bind path="*******" >
    <c:set var="editable" value="c:out value='${status.value}' />" />
    </spring:bind>

    When I display the var editable as below, I see either the values true or false, which is what I expected.

    <c:out value="${editable}" />

    However, if I do an if test immediately following the display above on the editable var checking for true or false, neither condition is ever met.

    <c:if test="${editable == 'true'}>
    some output
    </c:if

    <c:if test="${editable == 'false'}>
    some other output
    </c:if

    Why is the if test failing? Do I have a syntax error?

    Thank you.

  • #2
    I see my problem, the value being displayed is not true or false, but
    <c:out value='false'.

    I will have to look at how to fix this.

    Thank you

    Comment


    • #3
      If editable is a boolean, you can also do:
      Code:
      <c:if test="${editable == true}>
      some output
      </c:if>
      Maybe JSTL checks it as a String.

      Comment

      Working...
      X