JSTL - Variable not retrieving value

J

jill

I have declared a variable rowcolor. If i use c:eek:ut that works. So
following two line of code is worknig.

<c:set var="rowColor" value="even" scope="page"/>
<tr class="<c:eek:ut value='${rowColor}'/>">

But when i use below coe it does not work.
<tr class="${rowColor}">
HTML spits out <tr class="${rowColor}"> as this
where as in c:eek:ut version it spits out <tr class="even">

Can any body pls tell me why <tr class="${rowColor}"> is not working.
 
L

Lew

jill said:
I have declared a variable rowcolor. If i use c:eek:ut that works. So
following two line of code is worknig.

<c:set var="rowColor" value="even" scope="page"/>
<tr class="<c:eek:ut value='${rowColor}'/>">

But when i use below coe it does not work.
<tr class="${rowColor}">
HTML spits out <tr class="${rowColor}"> as this
where as in c:eek:ut version it spits out <tr class="even">

Can any body pls tell me why <tr class="${rowColor}"> is not working.

Repeating the question doesn't encourage people to answer.
Repeating the question doesn't encourage people to answer.

From your first posting of this question, in "JSTL - $variablename not working",
I doubt it very much. I would believe you got "${rowColor}", though.
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?

Just out of curiosity, why did you start a new thread on the same question?
 
J

jill

jillwrote:




Repeating the question doesn't encourage people to answer.
Repeating the question doesn't encourage people to answer.

From your first posting of this question, in "JSTL- $variablename not working",





jillwrote:







Just out of curiosity, why did you start a new thread on the same question?

I started a new thread because I could not see my questions posted in
the group.
 
J

jill

jillwrote:




Repeating the question doesn't encourage people to answer.
Repeating the question doesn't encourage people to answer.

From your first posting of this question, in "JSTL- $variablename not working",





jillwrote:







Just out of curiosity, why did you start a new thread on the same question?

I get

${rowColor}

even

${rowColor}

odd

for following code -

<c:forEach var="list" items="${foundationAidBean.childInstitutions}"
varStatus="status">
<c:choose>
<c:when test='${(status.index)%2 eq 0}'>
<c:set var="rowColor" value="even" scope="page"/>
</c:when>
<c:eek:therwise>
<c:set var="rowColor" value="odd" scope="page"/>
</c:eek:therwise>
</c:choose>

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


</c:forEach>


So it looks my jree version is not correct.

j2se - 1.4.2
Oracle JDeveloper 10g

What version should I use for my El to work.
 

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


Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top