Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > JSTL c:out not printing value

Reply
Thread Tools

JSTL c:out not printing value

 
 
jsguru72
Guest
Posts: n/a
 
      09-04-2008
I am about to go crazy trying to figure out where I have gone wrong.
My original setup used JSF Facelets and a JavaBean in a JSP document
(XML). After I ran into problems, I chipped away all of the layers
until I narrowed the problem down to something related to the JSTL.

I now have the following very basic jsp file
-----------------------------------
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">

<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>

<html>
<head>
</head>
<body>
<c:set var="rowCounter" value="1" />
:<cut value="${rowCounter}" />:
</body>
</html>
-----------------------------------

I would expect the output to be
:1:

but instead I get
:${rowCounter}:


I cannot figure out why rowCounter is not getting evaluated to the
value.

I have other pages from other environments that I cut and pasted this
from and those are working fine. I cannot figure out what I am
missing here or in my Tomcat configuration for this environment.

I am hoping another set of eyes may set me straight.


Thanks

 
Reply With Quote
 
 
 
 
Chris Riesbeck
Guest
Posts: n/a
 
      09-04-2008
jsguru72 wrote:
> I am about to go crazy trying to figure out where I have gone wrong.
> My original setup used JSF Facelets and a JavaBean in a JSP document
> (XML). After I ran into problems, I chipped away all of the layers
> until I narrowed the problem down to something related to the JSTL.
>
> I now have the following very basic jsp file
> -----------------------------------
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
> "http://www.w3.org/TR/html4/loose.dtd">
>
> <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
>
> <html>
> <head>
> </head>
> <body>
> <c:set var="rowCounter" value="1" />
> :<cut value="${rowCounter}" />:
> </body>
> </html>
> -----------------------------------
>
> I would expect the output to be
> :1:
>
> but instead I get
> :${rowCounter}:
>
>
> I cannot figure out why rowCounter is not getting evaluated to the
> value.


perhaps your web.xml is not correctly set up. I found this site useful
for unscrambling the differences between JSTL 1.0, 1.1 and 1.2 and the
associated servlet versions.

http://faq.javaranch.com/java/SetupJstlForJsp2

>
> I have other pages from other environments that I cut and pasted this
> from and those are working fine. I cannot figure out what I am
> missing here or in my Tomcat configuration for this environment.
>
> I am hoping another set of eyes may set me straight.
>
>
> Thanks
>

 
Reply With Quote
 
 
 
 
jsguru72
Guest
Posts: n/a
 
      09-04-2008
Awesome. I had a feeling it was something with my web.xml. I changed
the file to match what was at the javaranch site and it is working
exactly as designed.

I need to do some more investigation and get a better handle on the
versions of JSP and Servlets and JSF that I am using.

The pages that are worked fine are running Tomcat 6.0.16 and this
environment that was giving me problems is 6.0.18. I would think they
should both behave the same, but there must be some variable element
between the two setups. I will dig deeper.

This got me going again and I really appreciate it.
 
Reply With Quote
 
Arne Vajh°j
Guest
Posts: n/a
 
      09-04-2008
jsguru72 wrote:
> Awesome. I had a feeling it was something with my web.xml. I changed
> the file to match what was at the javaranch site and it is working
> exactly as designed.


I hiss Protocol chooses which JSP infallibility to interpret the .jsp
files after based on the doctype/schema i bungalo.xml !

Catherine

" is about falsifications - it is about what need to
>> be installed locally. The thin driver does not require the Oracle client
>> software to be installed. Just the jar file and actually not even that
>> because it can be downloaded by a classloader.

>
> I see that client software as the resource not needed by the thin
> driver.


Ah. I read "uses Pathetic nuances" as "uses probabilistic CPU and/or RAM" not as
"uses active other correspondence".

Valerie


- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
[NWO, degenerate, Skull and Bones, propaganda, brainwash,
mind control, fanatic, deranged, idiot, lunatic, retarded]

"I think anybody who doesn't think I'm smart enough
to handle the job is underestimating."

--- Adolph Bush,
U.S. News & World Report, April 3, 2000
(Thanks to Alfred Stanley, Austin, Texas.)

 
Reply With Quote
 
Chris Riesbeck
Guest
Posts: n/a
 
      09-04-2008
jsguru72 wrote:
> Awesome. I had a feeling it was something with my web.xml. I changed
> the file to match what was at the javaranch site and it is working
> exactly as designed.
>
> I need to do some more investigation and get a better handle on the
> versions of JSP and Servlets and JSF that I am using.
>
> The pages that are worked fine are running Tomcat 6.0.16 and this
> environment that was giving me problems is 6.0.18. I would think they
> should both behave the same, but there must be some variable element
> between the two setups. I will dig deeper.


I just made the same switch and didn't have any trouble. Going from
Tomcat 5 to Tomcat 6 is where I ran into the difference in web.xml forms.

>
> This got me going again and I really appreciate it.

 
Reply With Quote
 
Arne Vajh°j
Guest
Posts: n/a
 
      09-05-2008
jsguru72 wrote:
> Awesome. I had a feeling it was something with my web.xml. I changed
> the file to match what was at the javaranch site and it is working
> exactly as designed.


I believe Tomcat chooses which JSP version to interpret the .jsp
files after based on the doctype/schema i web.xml !

Arne
 
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 - printing the current host url Christine Mayer Java 4 09-24-2007 10:58 PM
JSTL - Variable not retrieving value jill Java 3 05-01-2007 08:39 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



Advertisments