JSTL c:out not printing value

Discussion in 'Java' started by jsguru72, Sep 4, 2008.

  1. jsguru72

    jsguru72 Guest

    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" />
    :<c:eek:ut 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
    jsguru72, Sep 4, 2008
    #1
    1. Advertising

  2. 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" />
    > :<c:eek:ut 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
    >
    Chris Riesbeck, Sep 4, 2008
    #2
    1. Advertising

  3. jsguru72

    jsguru72 Guest

    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.
    jsguru72, Sep 4, 2008
    #3
  4. jsguru72

    Arne Vajhøj Guest

    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.)
    Arne Vajhøj, Sep 4, 2008
    #4
  5. 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.
    Chris Riesbeck, Sep 5, 2008
    #5
  6. jsguru72

    Arne Vajhøj Guest

    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
    Arne Vajhøj, Sep 5, 2008
    #6
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Chris
    Replies:
    1
    Views:
    3,911
    Christophe Vanfleteren
    Jan 9, 2004
  2. Damian Sobieralski

    jstl and c:out value not being evaluated

    Damian Sobieralski, May 28, 2004, in forum: Java
    Replies:
    3
    Views:
    11,327
    Damian Sobieralski
    Jun 2, 2004
  3. Robert Mark Bram

    Custom JSTL that accepts JSTL expression

    Robert Mark Bram, Dec 15, 2004, in forum: Java
    Replies:
    0
    Views:
    956
    Robert Mark Bram
    Dec 15, 2004
  4. Christine Mayer

    JSTL - printing the current host url

    Christine Mayer, Sep 24, 2007, in forum: Java
    Replies:
    4
    Views:
    15,101
    Manish Pandit
    Sep 24, 2007
  5. DaFoot
    Replies:
    1
    Views:
    1,672
    DaFoot
    Oct 23, 2008
Loading...

Share This Page