Tomcat 5.5 JSP EL evaluation: what?

Discussion in 'Java' started by Owen Jacobson, May 3, 2006.

  1. I'm working my way through the Sun J2EE tutorial, but I'm stuck on the
    first web app.

    I'm running the sample web app "hello1" on a stock tomcat 5.5
    installation. The app theoretically demonstrates some simple JSTL
    features and EL evaluation; instead, it demonstrates nothing at all.

    My hello1.war contains:
    /index.jsp
    /META-INF/MANIFEST.MF
    /WEB-INF/web.xml
    /WEB-INF/c.tld # from commons-taglib
    /WEB-INF/fn.tld # ditto
    /WEB-INF/lib/jstl.jar # the same
    /WEB-INF/lib/standard.jar # likewise

    index.jsp:
    <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
    <%@ taglib uri="http://java.sun.com/jsp/jstl/function" prefix="fn" %>
    <html>
    <head>
    <title>Short, Simple Complete Compilable Code</title>
    </head>
    <body>
    <p>${param.username}</p>
    </body>
    </html>

    and web.xml:
    <web-app>
    <display-name>hello1</display-name>
    </web-app>

    (This originally had a number of fields from the example web.xml; it
    didn't work with those in place, either.)

    From the tutorial and the JSTL docs, requesting
    http://..../hello1/?username=Pennywise should print "Pennywise" on the
    page. Instead, it's printing the expression itself: ${param.username}

    Why?

    And where is this documented? I tried the tomcat docs, the JSP
    documentation, and google, with very little luck.

    -Owen
    Owen Jacobson, May 3, 2006
    #1
    1. Advertising

  2. Owen Jacobson

    steen Guest

    Owen Jacobson wrote:
    > index.jsp:
    > <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
    > <%@ taglib uri="http://java.sun.com/jsp/jstl/function" prefix="fn" %>
    > <html>
    > <head>
    > <title>Short, Simple Complete Compilable Code</title>
    > </head>
    > <body>
    > <p>${param.username}</p>
    > </body>
    > </html>

    ....
    > From the tutorial and the JSTL docs, requesting
    > http://..../hello1/?username=Pennywise should print "Pennywise" on the
    > page. Instead, it's printing the expression itself: ${param.username}
    >
    > Why?


    Try changing the ${param.username} to <c:eek:ut value="${param.username}"
    />
    because the way your jsp looks now, you're just asking it to print the
    string "${param.username}", but by calling the c:eek:ut tag magic things
    will happen.
    Check http://java.sun.com/webservices/docs/1.3/tutorial/doc/JSTL4.html
    for further information.

    /Steen
    steen, May 3, 2006
    #2
    1. Advertising

  3. On Wed, 03 May 2006 00:10:43 -0700, steen wrote:

    >
    > Owen Jacobson wrote:
    >> index.jsp:
    >> <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
    >> <%@ taglib uri="http://java.sun.com/jsp/jstl/function" prefix="fn" %>
    >> <html>
    >> <head>
    >> <title>Short, Simple Complete Compilable Code</title>
    >> </head>
    >> <body>
    >> <p>${param.username}</p>
    >> </body>
    >> </html>

    > ...
    >> From the tutorial and the JSTL docs, requesting
    >> http://..../hello1/?username=Pennywise should print "Pennywise" on the
    >> page. Instead, it's printing the expression itself: ${param.username}
    >>
    >> Why?

    >
    > Try changing the ${param.username} to <c:eek:ut value="${param.username}"
    > />
    > because the way your jsp looks now, you're just asking it to print the
    > string "${param.username}", but by calling the c:eek:ut tag magic things
    > will happen.
    > Check http://java.sun.com/webservices/docs/1.3/tutorial/doc/JSTL4.html
    > for further information.


    According to the JSP spec that's not actually necessary in JSP 2.0.
    The JSTL docs seem to confirm that; c:eek:ut makes it possible to work with
    EL in JSP prior to JSP 2.0.

    I think.

    Version soup in here.

    Anyways, point is, that didn't work either. What *did* work is using a
    set of attributes on <web-app> including version="2.4"; the example as
    downloaded has version="2.5".
    Owen Jacobson, May 3, 2006
    #3
    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. Replies:
    0
    Views:
    4,325
  2. Ilias Lazaridis
    Replies:
    2
    Views:
    378
    Ilias Lazaridis
    Apr 24, 2005
  3. tiewknvc9
    Replies:
    4
    Views:
    1,737
  4. Ilias Lazaridis
    Replies:
    74
    Views:
    713
    Ilias Lazaridis
    Apr 4, 2005
  5. Ilias Lazaridis
    Replies:
    18
    Views:
    317
    Bill Guindon
    Apr 9, 2005
Loading...

Share This Page