Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Wrox Announcements and Feedback > All Other Wrox Books
Password Reminder
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
All Other Wrox Books Do you have a question about a Wrox book that isn't listed anywhere on p2p.wrox.com or where the forum is locked? Here's a forum to post questions about any other Wrox book so that other readers or one of the authors can help you with your questions. IF YOU ARE LOOKING FOR CODE DO NOT ASK "Where can I find the code for this book?" That question is answered here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the All Other Wrox Books 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
Closed Thread
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old June 24th, 2003, 08:24 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 JSP 2.0 book question...re: variables

New to JSP and following the above book exercises.

Even the simplest request for a value from a variable does not get "processed" by the server but is just displayed like so:

"code snippet"

4 * 4 is ${4 * 4}

Should display result of that in curly braces (16) but when processed by BEA WebLogic server as a web app it doesn't throw errors but just repeats value:


4 * 4 is ${4 * 4}

In several other exercises from the book the same thing is happening. Up to chapter two all jsp pages run and display OK but variables are not evaluated.

Steve Garrison
Wilmington, DE
  #2 (permalink)  
Old August 5th, 2003, 05:41 PM
Authorized User
Join Date: Aug 2003
Location: Coventry, , United Kingdom.
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts

Yes. Of all the problems with the book this is one of the most subtle, and annoying.

The problem is the deployment descriptor (WEB-INF/web.xml file). For backwards compatibility, if you use an old-style (Servlet 2.3/ JSP 1.2) deployment descriptor, the JSP container must disable all the fancy new JSP 2.0 features which might break existing software. This includes the expression language (EL).

As the specification has it: "Each JSP page has a default EL evaluation mode that may be true or false. The default mode for JSP pages in a Web Application delivered using a web.xml using the Servlet 2.3 format is false; this provides for backward compatibility.
The default mode for JSP pages in a Web Application delivered using a web.xml using the Servlet 2.4 format is true; this provides automatically the default that most applications want.
The default can be changed by setting the value of the elEvaluation property of the page, either through a page directive, or through the JSP configuration information for the web application using the el-enabled element."

Now the problem with the early chapters in the BJSP2 book is that they don't use an explicit deployment descriptor at all, let alone a Servlet 2.4/JSP 2.0 descriptor. Tomcat then goes into "compatibility mode" and disables the expression language. The easiest way to address this would be to include the following snippet at the top of your JSP pages:

<%@page isELEnabled="true"%>

This should enable EL evaluation in the page. I have not tried this with the current version of Tomcat though. Alternatively, you could use a proper deployment descriptor as discussed (much) later in the book, along the lines of

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://java.sun.com/xml/ns/j2ee"

  <display-name>Hello World!</display-name>

Of course this oversight is unforgiveable; how come nobody caught this? Simple. At the time when the book was written, the only JSP 2.0 software was alpha quality, early access software which did not implement this JSP versioning feature at all, and all the code in the book worked happily for us. None of the reviewers picked up on it either.

Hope this helps

 - Peter

Closed Thread

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
finding free book "Beginning Jsp Book" ruzdi JSP Basics 0 December 7th, 2007 01:46 PM
Book required for Professional JSP 2.0, 2.1 Abhijith Wrox Book Feedback 1 August 29th, 2007 11:30 PM
sharing variables throughtout the jsp application kanoorani JSP Basics 3 April 23rd, 2007 11:36 PM
Using global variables in jsp sumon_24_feb JSP Basics 1 March 23rd, 2007 07:45 AM
Page 91 of book: Global Variables. Nick Y BOOK: Ivor Horton's Beginning Visual C++ 2005 1 June 24th, 2006 10:48 PM

All times are GMT -4. The time now is 06:56 AM.

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