Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > JSTL - $variablename not working

Reply
Thread Tools

JSTL - $variablename not working

 
 
jill
Guest
Posts: n/a
 
      04-24-2007
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 <cut value="${rowColor}"/> is worknig fine.

So my question is how to display rowcolor in for class with cut?

 
Reply With Quote
 
 
 
 
Lew
Guest
Posts: n/a
 
      04-25-2007
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 <cut value="${rowColor}"/> is worknig fine.
>
> So my question is how to display rowcolor in for class with cut?


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><cut value="${rowColor}"/></p>

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

What is your platform?

--
Lew
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
(struts/JSTL) Setting bean property value with jstl choose compoundresults DaFoot Java 1 10-23-2008 12:42 PM
JSTL - $variablename not working jill Java 0 04-24-2007 08:51 PM
Custom JSTL that accepts JSTL expression Robert Mark Bram Java 0 12-15-2004 12:26 AM
jstl and c:out value not being evaluated Damian Sobieralski Java 3 06-01-2004 11:24 PM
JSTL problem, expressions not being evaluated in c:out Chris Java 1 01-09-2004 03:05 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57