Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Java > Java and JDK > JSP Basics
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old June 18th, 2003, 08:59 AM
Registered User
 
Join Date: Jun 2003
Location: , , .
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.
Reply With Quote
  #2 (permalink)  
Old June 18th, 2003, 11:28 AM
Registered User
 
Join Date: Jun 2003
Location: Ipswich, Suffolk, United Kingdom.
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 ...)
Reply With Quote
  #3 (permalink)  
Old June 24th, 2003, 08:30 AM
Registered User
 
Join Date: Jun 2003
Location: wilmington, de, USA.
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
Reply With Quote
  #4 (permalink)  
Old July 28th, 2003, 08:21 AM
Registered User
 
Join Date: Jul 2003
Location: Totnes, Devon, United Kingdom.
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.


Reply With Quote
  #5 (permalink)  
Old July 30th, 2003, 04:00 AM
Registered User
 
Join Date: Jun 2003
Location: , , .
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.
Reply With Quote
  #6 (permalink)  
Old August 8th, 2003, 04:57 PM
Authorized User
 
Join Date: Aug 2003
Location: Coventry, , United Kingdom.
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

Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 10:16 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.