wood burning stoves 2.0*
The moose likes JSP and the fly likes JSTL when test problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "JSTL when test problem" Watch "JSTL when test problem" New topic
Author

JSTL when test problem

John Wetherbie
Rancher

Joined: Apr 05, 2000
Posts: 1441
Below is a code snippet from a JSP I have. I want the background colors of the rows in a table to alternate. I can make this work in scriptlet code fine but the when test below is returning false every time so that instead of alternating colors a single background color (specified by the otherwise tag) is displayed.

I'm assuming expression in the test is incorrect or I should be using a different form to represent the test but I'm not sure what that form would be.
Thanks,


The only reason for time is so that everything doesn't happen all at once.
- Buckaroo Banzai
John Wetherbie
Rancher

Joined: Apr 05, 2000
Posts: 1441
Also tried this...

but it does not appear to work either.
I'm very puzzled.
John Wetherbie
Rancher

Joined: Apr 05, 2000
Posts: 1441
Just an update...
The

seems to be working fine now. Not sure why it wasn't working yesterday. Maybe Tomcat was having a problem.
If the code above SHOULDN'T work please let me know.
Thanks,
Shawn Bayern
Author
Ranch Hand

Joined: May 06, 2002
Posts: 160
Originally posted by John Wetherbie:
Just an update...
The

seems to be working fine now. Not sure why it wasn't working yesterday. Maybe Tomcat was having a problem.
If the code above SHOULDN'T work please let me know.
Thanks,

This latter code should work. The code you tried first shouldn't work as such, since you can't use rtexprvalues without also using the "RT" version of JSTL taglibs. That is, you'd have to import the "c_rt" tag library, and say
<c_rt:when test="<%= ... %>">
In general, I recommend using the expression language ("${ ... }"), as your second example does.


Shawn Bayern<br />"JSTL in Action" <a href="http://www.jstlbook.com" target="_blank" rel="nofollow">http://www.jstlbook.com</a>
John Wetherbie
Rancher

Joined: Apr 05, 2000
Posts: 1441
Thanks, Shawn.
Like I said, Tomcat must have been having a problem. Everything works fine now. Weird.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JSTL when test problem
 
Similar Threads
JSTL List Help
Expression Language not supported in compile time attribute items
Problem using Spring bind
Coloring Table Rows
simple JSTL problem