JSTL - $variablename not working

J

jill

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?
 
L

Lew

jill said:
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?
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

JSTL - Variable not retrieving value 3
Can't insert dynamic link using jstl 1
JSTL Question 10
Slideshow not working properly 2
JSTL 0
JSTL error 1
JSTL config question 10
CSS Grid inside slider not working... 1

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,904
Latest member
HealthyVisionsCBDPrice

Latest Threads

Top