Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Tomcat 5.5 JSP EL evaluation: what?

Reply
Thread Tools

Tomcat 5.5 JSP EL evaluation: what?

 
 
Owen Jacobson
Guest
Posts: n/a
 
      05-03-2006
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
 
Reply With Quote
 
 
 
 
steen
Guest
Posts: n/a
 
      05-03-2006

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 <cut 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 cut tag magic things
will happen.
Check http://java.sun.com/webservices/docs...doc/JSTL4.html
for further information.

/Steen

 
Reply With Quote
 
 
 
 
Owen Jacobson
Guest
Posts: n/a
 
      05-03-2006
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 <cut 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 cut tag magic things
> will happen.
> Check http://java.sun.com/webservices/docs...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; cut 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".

 
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
Tomcat not updating index.jsp to my jsp file! tiewknvc9 Java 4 05-12-2007 12:03 AM
[JSP] difference between jsp:forward and jsp:include alexjaquet@gmail.com Java 0 06-02-2006 01:21 PM
Tomcat Web application manager - Virtual host Tomcat 4.30 + Apache2 + JK2 connector with multi IPs Joe Java 0 07-12-2004 03:06 PM
Apache Tomcat 4.1.24: problem with Tomcat Administration link Christos Gravvanis Java 0 07-07-2004 05:21 PM
[TOMCAT] Tomcat crashes %=zerointeractive.it% Java 1 01-22-2004 12:08 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57