JSTL - $variablename not working

Discussion in 'Java' started by jill, Apr 24, 2007.

  1. jill

    jill Guest

    Please let me know why below code is ot worknig and how to solve it.

    <c:choose>
    <c:when test='${(status.index)%2 eq 0}'>
    <c:set var="rowColor" value="even" scope="page"/>
    </c:when>
    </c:choose>

    <tr class="${rowColor}">

    I get "${rowcolor}" in html for above line of code -- <tr class="$
    {rowColor}">
    ..

    But <c:eek:ut value="${rowColor}"/> is worknig fine.

    So my question is how to display rowcolor in for class with c:eek:ut?
    jill, Apr 24, 2007
    #1
    1. Advertising

  2. jill

    Lew Guest

    jill wrote:
    > Please let me know why below code is ot worknig and how to solve it.
    >
    > <c:choose>
    > <c:when test='${(status.index)%2 eq 0}'>
    > <c:set var="rowColor" value="even" scope="page"/>
    > </c:when>
    > </c:choose>
    >
    > <tr class="${rowColor}">
    >
    > I get "${rowcolor}" in html for above line of code -- <tr class="$
    > {rowColor}">


    I doubt it very much. I would believe you got "${rowColor}", though.

    > But <c:eek:ut value="${rowColor}"/> is worknig fine.
    >
    > So my question is how to display rowcolor in for class with c:eek:ut?


    How is var="rowColor" set when the c:when condition fails?

    Your question would be easier for us to approach if you posted an SSCCE.

    You might be working with a version of JEE that only accepts EL in JSTL
    constructs. Since <tr> is not a JSTL tag, it wouldn't parse the EL expression
    in that scenario.

    Compare
    <p>${rowColor}</p>
    <p><c:eek:ut value="${rowColor}"/></p>

    in a test page (which you could post as an SSCCE). What do you get?

    What is your platform?

    --
    Lew
    Lew, Apr 25, 2007
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Chris
    Replies:
    1
    Views:
    3,923
    Christophe Vanfleteren
    Jan 9, 2004
  2. Damian Sobieralski

    jstl and c:out value not being evaluated

    Damian Sobieralski, May 28, 2004, in forum: Java
    Replies:
    3
    Views:
    11,398
    Damian Sobieralski
    Jun 2, 2004
  3. Robert Mark Bram

    Custom JSTL that accepts JSTL expression

    Robert Mark Bram, Dec 15, 2004, in forum: Java
    Replies:
    0
    Views:
    968
    Robert Mark Bram
    Dec 15, 2004
  4. jill
    Replies:
    0
    Views:
    278
  5. DaFoot
    Replies:
    1
    Views:
    1,684
    DaFoot
    Oct 23, 2008
Loading...

Share This Page