Announcement Announcement Module
Collapse
No announcement yet.
c:if using JSP variable and a spring:bind variable? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • c:if using JSP variable and a spring:bind variable?

    I need to perform the equivalent of:

    <c:if test="${dummyA == dummyB}">

    where "dummyA" is a JSP variable, ie.

    <%
    String dummyA = ....
    %>

    and "dummyB" is a <spring:bind path="command.dummyB"> value.

    How do I compare a JSP variable and a bound spring attribute in a JSTL if statement?

    Any help is sincerely appreciated.

    Jim

  • #2
    Code:
    <spring&#58;bind path="command.dummyB">
      <c&#58;if test="$&#123;dummyA == status.value&#125;">
        ...
      </c&#58;if>
    </spring>
    HTH

    Comment


    • #3
      I tried that, but dummyA was null. Is dummyA visible within the core jstl lib?

      Comment


      • #4
        Scripting variables versus pageContext variables

        JSTL references variables in the pageContext and does not have access to scripting variables. You probably want to do something like:

        Code:
        pageContext.setAttribute&#40;"dummyA", dummyA&#41;;
        Hope that helps,
        Derek
        dadams at gaijin-studio dot org

        Comment

        Working...
        X