Wrox Programmer Forums
|
JSP Basics Beginning-level questions on JSP. More advanced coders should post to Pro JSP.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the JSP Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 18th, 2003, 08:59 AM
Registered User
 
Join Date: Jun 2003
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default JSTL

Hi,

I followed carefully instructions in Beginning JSP 2.0
in installing Tomcat and JSTL. All examples went well, but when I try
examples in chapter 2 - RequestHeader (request.jsp). These are the only thing appeared on the browser :

You sent the following request headers:

+------------+--------------+
| Header | Value |
+------------+--------------+
|${entry.key}|${entry.value}|
+------------+--------------+

For your info,
I using a standalone Win2K Advance Server, Apache
Tomcat4.1, J2sdk1.4.1_02 and JSTL 1.0.2.

Thanks.
 
Old June 18th, 2003, 11:28 AM
Registered User
 
Join Date: Jun 2003
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Have you set up a complete directory structure?
e.g.
 ..\tomcat\webapps\AppName
 ..\tomcat\webapps\AppName\WEB-INF
 ..\tomcat\webapps\AppName\WEB-INF\classes
 ..\tomcat\webapps\AppName\WEB-INF\lib

Even if empty, I think JSP complains if they are not there...

(Also check the taglib directive, and web.xml files ...)
 
Old June 24th, 2003, 08:30 AM
Registered User
 
Join Date: Jun 2003
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to troutguy
Default

The same thing is happening for examples I'm using from the same book.

Server is not throwing errors but merely ignores the variables it's supposed to process.

It's done it for all exercises for me so far including something as simple as:

4 * 4 is ${4 * 4} Instead of showing 16 it just returns 4 * 4 is ${4 * 4} without evaluating.

Tried putting values inside <% %> symbol but that made no difference.??

I'm using BEA WebLogic Express, Win 2000 Pro.




Steve Garrison
Wilmington, DE
 
Old July 28th, 2003, 08:21 AM
Registered User
 
Join Date: Jul 2003
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I've got the same problem. I'm using the Tomcat 5.0 alpha; my impression is that Tomcat 4 does not support the JSTL expression language in the way shown in this book; you have to use
<c:out value="${somevalue}" />
That's how it goes in Shawn Bayern's excellent book JSTL in action.


 
Old July 30th, 2003, 04:00 AM
Registered User
 
Join Date: Jun 2003
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Yeah, i agreed with Charles. Right now i'm using JWSDP which include Tomcat 5.0. So far, all examples went well with it.
 
Old August 8th, 2003, 04:57 PM
Authorized User
 
Join Date: Aug 2003
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Default

The price of working with a technology that isn't finalised yet, probably. What might also cause a problem is that a JSP container is supposed to switch to what one could term "JSP 1.2 compatibility mode" -- without expression language (EL) support -- when it finds a WEB-INF/web.xml file that conforms to the old Servlet 2.3 DTD rather than the 2.4 schema. It's undefined what happens if you don't have a web.xml file at all.

Many of my co-authors seem not to have realised this. Of course, it all worked fine in our prerelease software, making it easy to remain blissfully unaware of this. It will not work in production releases.

One thing to appreciate about the JSTL tags: if, in a JSP 1.2 container, you say

<%@taglib prefix="c" uri="http://java.sun.com/jstl/core"%>
<c:out value="${somevalue}"/>

you are passing the String "${somevalue}" into the JSP tag. This tag then calls an EL parser which figures out what you mean and evaluates the expression.

If, on the other hand, in a JSP 2.0 container you say

<%@taglib prefix="c" uri="http://java.sun.com/jstl/core_rt"%>
<c:out value="${somevalue}"/>

the container evaluates the ${somevalue} expression, which might return a primitive or any Object, and passes the result into the tag. That's why you need the _rt versions of the tags in a JSP 2.0 container. From a tag's perspective, the two code fragments above work completely differently even if they are the same to you.

The advantages? The main advantage is that EL is no longer restricted to the JSTL tags, as you do not need EL support in the tags themselves -- in a JSP 2.0 container, EL works for any tag, and can also be used in the HTML text itself.

 - Peter






Similar Threads
Thread Thread Starter Forum Replies Last Post
JSTL problem winsonkkp JSP Basics 3 August 9th, 2007 03:20 AM
jstl problem saeed JSP Basics 1 May 22nd, 2007 12:18 PM
jstl problem vivekkumar_23 Pro JSP 1 May 1st, 2007 04:30 AM
JSTL is not responding? startjsp JSP Basics 0 May 25th, 2006 02:03 AM
JSTL aadz5 JSP Basics 1 August 8th, 2005 08:26 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.