Results 1 to 4 of 4

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

  1. #1
    Join Date
    Nov 2004
    Posts
    6

    Default 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. #2
    Join Date
    Aug 2004
    Location
    Montréal, Canada
    Posts
    845

    Default

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

    Spring Modules Team
    http://irbouh.blogspot.com/

  3. #3
    Join Date
    Nov 2004
    Posts
    6

    Default

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

  4. #4
    Join Date
    Oct 2004
    Location
    Atlanta, GA
    Posts
    38

    Default 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

Similar Threads

  1. Oracle OC4J 904 and environment variable
    By jasonmcdermott in forum EJB
    Replies: 2
    Last Post: Sep 28th, 2005, 02:25 AM
  2. Passing variable from an URL
    By strbuf in forum Web
    Replies: 3
    Last Post: Aug 12th, 2005, 10:40 PM
  3. Replies: 3
    Last Post: Aug 5th, 2005, 08:39 AM
  4. Replies: 4
    Last Post: Jul 21st, 2005, 01:07 AM
  5. Replies: 3
    Last Post: Dec 31st, 2004, 07:08 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •