Announcement Announcement Module
No announcement yet.
Jstl c:set question Page Title Module
Move Remove Collapse
Conversation Detail Module
  • 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}' />" />

    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 test="${editable == 'false'}>
    some other output

    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


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