JSTL problem, expressions not being evaluated in c:out

Discussion in 'Java' started by Chris, Jan 9, 2004.

  1. Chris

    Chris Guest

    I'm just starting to use the Java Standard template library,
    and I'm having a problem with my expessions being output
    correctly by the c:eek:ut tag.

    I've followed all of the instructions for installing JSTL,
    and I am using it under Tomcat 5.0.

    Here is the relevant snippet from my JSP:

    <%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %
    <c:set var="browser" value="${header['User-Agent']}"/>
    <c:eek:ut value="${browser}"/>

    When the page is rendered, I get the output
    "${browser}" instead of the evaluated expression. What am I
    doing wrong?
    Thanks in advance
    Chris, Jan 9, 2004
    #1
    1. Advertising

  2. Chris wrote:

    > I'm just starting to use the Java Standard template library,
    > and I'm having a problem with my expessions being output
    > correctly by the c:eek:ut tag.
    >
    > I've followed all of the instructions for installing JSTL,
    > and I am using it under Tomcat 5.0.
    >
    > Here is the relevant snippet from my JSP:
    >
    > <%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %
    > <c:set var="browser" value="${header['User-Agent']}"/>
    > <c:eek:ut value="${browser}"/>
    >
    > When the page is rendered, I get the output
    > "${browser}" instead of the evaluated expression. What am I
    > doing wrong?
    > Thanks in advance


    Change the <%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
    to <%@ taglib prefix="c" uri="http://java.sun.com/jstl/core_rt" %> when
    using JSP 2 (which Tomcat 5 does). Your code would be correct if you used
    JSP 1.2 (Tomcat 4.X series) instead.

    Also, you don't need the <c:eek:ut> anymore in JSP 2, you can just type
    something like
    "browser = ${browser}"

    --
    Kind regards,
    Christophe Vanfleteren
    Christophe Vanfleteren, Jan 9, 2004
    #2
    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. Jason Wright via .NET 247
    Replies:
    2
    Views:
    684
    Brian W
    Jun 12, 2004
  2. Damian Sobieralski

    jstl and c:out value not being evaluated

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

    Custom JSTL that accepts JSTL expression

    Robert Mark Bram, Dec 15, 2004, in forum: Java
    Replies:
    0
    Views:
    968
    Robert Mark Bram
    Dec 15, 2004
  5. Michael Hartl
    Replies:
    6
    Views:
    112
    Michael Hartl
    Mar 28, 2006
Loading...

Share This Page