Core Servlets and JavaServer Pages: Volume I: Core Technologies / Edition 2

Paperback (Print)
Rent
Rent from BN.com
$17.42
(Save 75%)
Est. Return Date: 09/28/2014
Buy Used
Buy Used from BN.com
$41.17
(Save 41%)
Item is in good condition but packaging may have signs of shelf wear/aging or torn packaging.
Condition: Used – Good details
Used and New from Other Sellers
Used and New from Other Sellers
from $1.99
Usually ships in 1-2 business days
(Save 97%)
Other sellers (Paperback)
  • All (34) from $1.99   
  • New (8) from $17.50   
  • Used (26) from $1.99   

Overview

The J2EE(TM) Platform has become the technology of choice for developing professional e-commerce applications, interactive Web sites, and Web-enabled applications and services. Servlet and JSP(TM) technology is the foundation of this platform: it provides the link between Web clients and server-side applications. In this 2nd edition of the worldwide bestseller, the authors show you how to apply the latest servlet and JSP capabilities. Unlike other books that treat servlet or JSP technology in isolation, Core Servlets and JavaServer Pages provides a unified treatment, showing you when servlet technology is best, when the JSP approach is preferred, and when (and how) servlets and JSP should work together.

Part I provides exhaustive coverage of the servlet 2.4 specification. It starts with server configuration, basic syntax, the servlet life cycle, and use of form data. It moves on to applying HTTP 1.1, cookies, and session tracking. Advanced topics include compressing Web content, incrementally updating results, dynamically generating images, and creating shopping carts.

Part II gives an in-depth guide to JSP 2.0. It covers both the "classic" JSP scripting elements and the new JSP 2.0 expression language. It shows how to control the content type, designate error pages, include files, and integrate JavaBeans components. Advanced topics include sharing beans, generating Excel spreadsheets, and dealing with concurrency.

Part III covers two key supporting technologies: HTML forms and database access with JDBC(TM). It explains every standard HTML input element and shows how to use appropriate JDBC drivers, perform database queries, process results, and perform updates. Advanced topics include parameterized queries, stored procedures, and transaction control.

Design strategies include ways to integrate servlet and JSP technology, best practices for invoking Java code from JSP pages, plans for dealing with missing and malformed data, and application of the MVC architecture.

Handy guides walk you through use of three popular servlet and JSP engines (Apache Tomcat, Macromedia JRun, and Caucho Resin) and some of the most widely used database systems (MySQL, Oracle9i, Microsoft Access).

Volume 2 of this book covers advanced topics: filters, custom tag libraries, database connection pooling, Web application security, the JSP Standard Tag Library (JSTL), Apache Struts, JavaServer Faces (JSF), JAXB, and more.

  • The same clear step-by-step explanations that made the first edition so popular
  • Completely updated for the latest standards: servlets 2.4 and JSP 2.0
  • Hundreds of completely portable, fully documented,industrial-strength examples

Detailed treatment of Apache Tomcat, Macromedia JRun, and Caucho Resin Online access to all source code, available free for unrestricted use at the author's www.coreservlets.com web site.

Read More Show Less

Editorial Reviews

From Barnes & Noble
The Barnes & Noble Review
Only a few computer books become classics. Marty Hall’s Core Servlets and JavaServer Pages (JSP) was one of them. First published in late 2000, it earned virtually overnight recognition as the definitive servlet/JSP guide. Even Microsoft praised it -- not something you often see with a Java book.

Servlet/JSP standards and techniques have progressed since then, however, so it’s a pleasure to introduce Core Servlets and JavaServer Pages (JSP), Second Edition.

With some help from Core Web Programming coauthor Larry Brown, Hall has thoroughly updated this book to reflect the latest Servlet 2.4 and JSP 2.0 standards. This new edition also reflects everything Hall’s learned over the past few years, as one of the world’s leading Servlet/JSP trainers and consultants.

Yes, if you’re wondering, the new edition contains a complete discussion of the important new JavaServer Pages Standard Tag Library. JSTL simplifies the creation of powerful JSP applications by encapsulating core functionality -- no more reinventing the wheel. It also gives developers a powerful expression language to work with. It’s indispensable -- and who better to learn it from?

Like other books in Prentice Hall PTR’s Core Series, this book assumes you’re a professional, working programmer, and gives you plenty of robust code examples. It also offers deep insight on how these technologies complement each other, when to use each, and how to integrate both.

After thoroughly reviewing the uses of servlet and JSP technology, Hall and Brown walk you step-by-step through server setup and configuration, addressing leading platforms that range from Tomcat and JRun to Caucho Resin, the new, super-quick XML-based servlet/JSP application server.

Next, you’ll master the meat-and-potatoes tasks associated with servlet development: handling client requests via form data and HTTP request headers; generating server responses via HTTP status codes and response headers; using cookies; and tracking sessions.

The authors then turn to JSP. You’ll learn how to invoke Java code with JSP scripting elements; then use JSP page directives to control the structure of generated servlets. There’s a full chapter on including files and applets in your JSP pages; and another on integrating JavaBeans components with your JSP documents. Many developers will especially appreciate the authors’ introduction to Model View Controller (MVC) architecture, now the de facto standard for separating business logic, presentation, and program flow.

JSP and servlets don’t work in isolation; they integrate with a wide range of supporting technologies. So it’s great to see that Hall and Brown have added an entire section on these integration issues. They especially focus on database access. There’s an entire chapter on JDBC, as well as step-by-step coverage of configuring three leading database platforms for use with JSP and servlets: Oracle 9i, MySQL, and even Microsoft Access.

If you’re an experienced developer who wants to buy one JSP/servlets book, you can’t go wrong with Core Servlets and JavaServer Pages (JSP), Second Edition. Bill Camarda

Bill Camarda is a consultant, writer, and web/multimedia content developer. His 15 books include Special Edition Using Word 2000 and Upgrading & Fixing Networks for Dummies, Second Edition.

Read More Show Less

Product Details

  • ISBN-13: 9780130092298
  • Publisher: Prentice Hall
  • Publication date: 8/30/2003
  • Series: Sun Core Series
  • Edition description: REV
  • Edition number: 2
  • Pages: 691
  • Product dimensions: 7.00 (w) x 9.30 (h) x 1.41 (d)

Meet the Author

MARTY HALL is president of coreservlets.com, Inc., a small company that provides training courses and consulting services related to server-side Java technology. He also teaches Java and Web programming in the Johns Hopkins University part-time graduate program in Computer Science, where he directs the Distributed Computing and Web Technology concentration areas. Marty is the author of four books from Prentice Hall and Sun Microsystems Press: the first edition of Core Servlets and JavaServer Pages, More Servlets and JavaServer Pages, and the first and second editions of Core Web Programming.

LARRY BROWN is a Senior Network Engineer and Oracle DBA for the U.S. Navy (NSWCCD), where he specializes in developing and deploying network and Web solutions in an enterprise environment. He is also a Computer Science faculty member at the Johns Hopkins University, where he teachers server-side programming, distributed Web programming, and Java user interface development for the part-time graduate program. Larry is the co-author of the second edition of Core Web Programming, also from Prentice Hall and Sun Microsystems Press.

Read More Show Less

Read an Excerpt

Suppose your company wants to sell products online. You have a database that gives the price and inventory status of each item. But, your database doesn't speak HTTP, the protocol that Web browsers use. Nor does it output HTML, the format Web browsers need. What can you do? Once users know what they want to buy, how do you gather that information? You want to customize your site for visitors' preferences and interests—how? You want to keep track of user's purchases as they shop at your site—what techniques are required to implement this behavior? When your Web site becomes popular, you might want to compress pages to reduce bandwidth. How can you do this without causing your site to fail for the 30% of visitors whose browsers don't support compression? In all these cases, you need a program to act as the intermediary between the browser and some server-side resource. This book is about using the Java platform for this type of program.

"Wait a second," you say. "Didn't you already write a book about that?" Well, yes. In May of 2000, Sun Microsystems Press and Prentice Hall released Marty's second book, Core Servlets and JavaServer Pages. It was successful beyond everyone's wildest expectations, selling approximately 100,000 copies, getting translated into Bulgarian, Chinese simplified script, Chinese traditional script, Czech, French, German, Hebrew, Japanese, Korean, Polish, Russian, and Spanish, and being chosen by Amazon.com as one of the top five computer programming books of 2001. Even better, Marty was swamped with requests for what he really likes doing: teaching training courses for developers in industry. Despite having to decline most of the requests, he wasstill able to teach servlet and JSP short courses in Australia, Canada, Japan, Puerto Rico, the Philippines, and at dozens of U.S. venues. What fun!

Since then, use of servlets and JSP has continued to grow at a phenomenal rate. The Java 2 Platform has become the technology of choice for developing e-commerce applications, dynamic Web sites, and Web-enabled applications and service. Servlets and JSP continue to be the foundation of this platform—they provide the link between Web clients and server-side applications. Virtually all major Web servers for Windows, Unix (including Linux), MacOS, VMS, and mainframe operating systems now support servlet and JSP technology either natively or by means of a plugin. With only a small amount of configuration, you can run servlets and JSP in Microsoft IIS, the Apache Web Server, IBM WebSphere, BEA WebLogic, Oracle9i AS, and dozens of other servers. Performance of both commercial and open-source servlet and JSP engines has improved significantly.

However, the field continues to evolve rapidly. For example:

  • The official servlet and JSP reference implementation is no longer developed by Sun. Instead, it is Apache Tomcat, an open-source product developed by a team from many different organizations. So, we provide great detail on Tomcat configuration and usage.
  • Except for Tomcat, the servers popular when the book was first released are no longer widely used. So, we cover Macromedia JRun and Caucho Resin instead.
  • Version 2.4 of the servlet specification was released in late 2003. Many APIs have been added or have changed. So, we have upgraded the book to be consistent with these APIs.
  • Version 2.0 of the JSP specification was released (also late 2003). This version lets you use a shorthand expression language to access bean properties and collection elements. So, we cover both "classic" scripting and use of the JSP 2.0 expression language.
  • Two new versions of JDBC have been released, providing many useful new features. So, we explain database access in the context of these new features.
  • MySQL has emerged as a popular free database. So, we explain how to download, configure, and use MySQL (we also cover Oracle9i and Microsoft Access, of course).

Whew. Lots of action in the server-side Java community. Yup; and to reflect this fact, the book has been completely and totally rewritten from top to bottom. Many new capabilities are now covered. Experienced developer Larry Brown was brought in to add his expertise, especially in database applications. Many hard-learned lessons are explained in detail. Many techniques are now approached differently.

The new version provides a thorough and up-to-date introduction to servlet and JSP programming. We hope you find it useful.Who Should Read This Book

This book is aimed at two main groups.

The primary audience is developers who are familiar with the basics of the Java programming language itself but have little or no experience with server-side applications. For you, virtually the entire book should be valuable; with the possible exception of the JSP 2.0 expression language (which is not applicable if you are using a server that is compliant only with JSP 1.2), you are likely to use capabilities from almost every chapter in almost every real-world application.

The second group is composed of people who are familiar with basic servlet and JSP development and want to learn how to make use of the new capabilities we just described. If you are in this category, you can skim many of the chapters, focusing on the capabilities that are new in servlets 2.4, JSP 2.0, or JDBC 3.0.

Although this book is well suited for both experienced servlet and JSP programmers and newcomers to the technology, it assumes that you are familiar with basic Java programming. You don't have to be an expert Java developer, but if you know nothing about the Java programming language, this is not the place to start. After all, servlet and JSP technology is an application of the Java programming language. If you don't know the language, you can't apply it. So, if you know nothing about basic Java development, start with a good introductory book like Thinking in Java, Core Java, or Core Web Programming. Come back here after you are comfortable with at least the basics.Volume 2

This first volume of the book focuses on core technologies: the servlet and JSP capabilities that you are likely to use in almost every real-life project. The second volume focuses on advanced capabilities: features that you use less frequently but that are extremely valuable in complex applications.

These topics include servlet and JSP filters, declarative and programmatic Web application security, custom tag libraries, the JSP Standard Tag Library (JSTL), Apache Struts, JavaServer Faces (JSF), Java Architecture for

For information on the release date of Volume 2, please see the book's Web site at <http://www.coreservlets.com/>.Distinctive Features

This book has five important characteristics that set it apart from many other similar-sounding books:

  • Integrated coverage of servlets and JSP. The two technologies are closely related; you should learn and use them together.
  • Real code. Complete, working, documented programs are essential to learning; we provide lots of them.
  • Step-by-step instructions. Complex tasks are broken down into simple steps that are illustrated with real examples.
  • Server configuration and usage details. We supply lots of concrete examples to get you going quickly.
  • Design strategies. We give lots of experience-based tips on best approaches and practices.
Integrated Coverage of Servlets and JSP

One of the key philosophies behind Core Servlets and JavaServer Pages is that servlets and JSP should be learned (and used!) together, not separately. After all, they aren't two entirely distinct technologies: JSP is just a different way of writing servlets. If you don't know servlet programming, you can't use servlets when they are a better choice than JSP, you can't use the MVC architecture to integrate servlets and JSP, you can't understand complex JSP constructs, and you can't understand how JSP scripting elements work (since they are really just servlet code). If you don't understand JSP development, you can't use JSP when it is a better option than servlet technology, you can't use the MVC architecture, and you are stuck using print statements even for pages that consist almost entirely of static HTML.

Servlets and JSP go together! Learn them together!Real Code

Sure, small code snippets are useful for introducing concepts. The book has lots of them. But, for you to really understand how to use various techniques, you also need to see the techniques in the context of complete working programs. Not huge programs: just ones that have no missing pieces and thus really run. We provide plenty of such programs, all of them documented and available for unrestricted use at <http://www.coreservlets.com>.Step-by-Step Instructions

When Marty was a Computer Science graduate student (long before Java existed), he had an Algorithms professor who stated in class that he was a believer in step-by-step instructions. Marty was puzzled: wasn't everyone? Not at all. Sure, most instructors explained simple tasks that way, but this professor took even highly theoretical concepts and said "first you do this, then you do that," and so on. The other instructors didn't explain things this way; neither did his textbooks. But, it helped Marty enormously.

If such an approach works even for theoretical subjects, how much more should it work with applied tasks like those described in this book?Server Configuration and Usage Details

When Marty first tried to learn server-side programming, he grabbed a couple of books, the official specifications, and some online papers. Almost without fail, they said something like "since this technology is portable, you need to read your server's documentation to know how to execute servlets or JSP pages." Aargh! He couldn't even get started. After hunting around, he downloaded a server. He wrote some code. How did he compile it? Where did he put it after it was compiled? How did he invoke it? How about some help here?

Servlet and JSP code is portable. The APIs are standardized. But, server structure and organization are not standardized. The directory in which you place your code is different on Tomcat than it is on JRun. You set up Web applications differently with Resin than you do with other servers. These details are important.

Now, we're not saying that this is a book that is specific to any particular server. We're just saying that when a topic requires server-specific knowledge, it is important to say so. Furthermore, specific examples are helpful. So, when we describe a topic that requires server-specific information like the directory in which to place a Web application, we first explain the general pattern that servers tend to follow. Then, we give very specific details for three of the most popular servers that are available without cost for desktop development: Apache Tomcat, Macromedia JRun, and Caucho Resin.Design Strategies

Sure, it is valuable to know what capabilities the APIs provide. And yes, syntax details are important. But, you also need the big picture. When is a certain approach best? Why? What gotchas do you have to watch out for? Servlet and JSP technology is not perfect; how should you design your system to maximize its strengths and minimize its weaknesses? What strategies simplify the long-term maintenance of your projects? What approaches should you avoid?

We're not new to servlet and JSP technology. We've been doing it for years. And, we've gotten feedback from hundreds of readers and students from Marty's training courses. So, we don't just show you how to use individual features; we explain how these features fit into overall system design and highlight best practices and strategies.How This Book Is Organized

This book consists of three parts: servlet technology, JSP technology, and supporting technologies.Part I: Servlet Technology

  • Downloading and configuring a free server
  • Setting up your development environment
  • Deploying servlets and JSP pages: some options
  • Organizing projects in Web applications
  • Building basic servlets
  • Understanding the servlet life cycle
  • Dealing with multithreading problems
  • Debugging servlets and JSP pages
  • Reading form parameters
  • Handling missing and malformed data
  • Dealing with incomplete form submissions
  • Using HTTP request headers
  • Compressing pages
  • Customizing pages based on browser types or how users got there
  • Manipulating HTTP status codes and response headers
  • Redirecting requests
  • Building Excel spread sheets with servlets
  • Generating custom JPEG images from servlets
  • Sending incremental updates to the user
  • Handling cookies
  • Remembering user preferences
  • Tracking sessions
  • Differentiating between browser and server sessions
  • Accumulating user purchases
  • Implementing shopping carts
Part II: JSP Technology
  • Understanding the need for JSP
  • Evaluating strategies for invoking Java code from JSP pages
  • Invoking Java code with classic JSP scripting elements
  • Using the predefined JSP variables (implicit objects)
  • Controlling code structure with the page directive
  • Generating Excel spread sheets with JSP pages
  • Controlling multithreading behavior
  • Including pages at request time
  • Including pages at compile time
  • Using JavaBeans components
  • Setting bean properties automatically
  • Sharing beans
  • Integrating servlets and JSP pages with the MVC architecture
  • Using RequestDispatcher
  • Comparing MVC data-sharing options
  • Accessing beans with the JSP 2.0 expression language
  • Using uniform syntax to access array elements, List items, and Map entries
  • Using expression language operators
Part III: Supporting Technologies
  • Accessing databases with JDBC
  • Simplifying JDBC usage
  • Using precompiled (parameterized) queries
  • Executing stored procedures
  • Controlling transactions
  • Using JDO and other object-to-relational mappings
  • Configuring Oracle, MySQL, and Microsoft Access for use with JDBC
  • Creating HTML forms
  • Surveying all legal HTML form elements
  • Debugging forms with a custom Web server
About the Web Site

The book has a companion Web site at <http://www.coreservlets.com/>. This free site includes:

  • Documented source code for all examples shown in the book; this code can be downloaded for unrestricted use
  • Links to all URLs mentioned in the text of the book
  • Up-to-date download sites for servlet and JSP software
  • Information on book discounts
  • Book additions, updates, and news
About the Training Courses

Hands-on JSP and servlet training courses based on the book are also available. These courses are personally developed and taught by the lead author of the book (Marty). Open-enrollment versions based on the first and second volumes are available at public venues; customizable on-site versions can also be taught at your organization. See <http://courses.coreservlets.com/> for details.

Read More Show Less

Table of Contents

I. Servlet Technology

1. An Overview of Servlet and JSP Technology.

2. Server Setup and Configuration.

3. Servlet Basics.

4. Handling the Client Request: Form Data.

5. Handling the Client Request: HTTP Request Headers.

6. Generating the Server Response: HTTP Status Codes.

7. Generating the Server Response: HTTP Response Headers.

8. Handling Cookies.

9. Session Tracking.

II. JSP Technology.

10. Overview of JSP Technology.

11. Invoking Java Technology Code with JSP Scripting Elements.

12. Controlling the Structure of Generated Servlets: The JSP Page Directive.

13. Including Files and Applets in JSP Pages.

14. Using JavaBeans Components in JSP Documents.

15. Integrating Servlets and JSP: the Model View Controller (MVC) Architecture.

16. Simplifying Access to Java Code: The JSP 2.0 Expression Language.

III. Supporting Technology.

17. Accessing Databases with JDBC.

18. Configuring Microsoft Access, MySql, and Oracle9i.

19. Creating and Processing HTML Forms.

Appendix. Server Organization and Structure.

Index.

Read More Show Less

Preface

Suppose your company wants to sell products online. You have a database that gives the price and inventory status of each item. But, your database doesn't speak HTTP, the protocol that Web browsers use. Nor does it output HTML, the format Web browsers need. What can you do? Once users know what they want to buy, how do you gather that information? You want to customize your site for visitors' preferences and interests--how? You want to keep track of user's purchases as they shop at your site--what techniques are required to implement this behavior? When your Web site becomes popular, you might want to compress pages to reduce bandwidth. How can you do this without causing your site to fail for the 30% of visitors whose browsers don't support compression? In all these cases, you need a program to act as the intermediary between the browser and some server-side resource. This book is about using the Java platform for this type of program.

"Wait a second," you say. "Didn't you already write a book about that?" Well, yes. In May of 2000, Sun Microsystems Press and Prentice Hall released Marty's second book, Core Servlets and JavaServer Pages. It was successful beyond everyone's wildest expectations, selling approximately 100,000 copies, getting translated into Bulgarian, Chinese simplified script, Chinese traditional script, Czech, French, German, Hebrew, Japanese, Korean, Polish, Russian, and Spanish, and being chosen by Amazon.com as one of the top five computer programming books of 2001. Even better, Marty was swamped with requests for what he really likes doing: teaching training courses for developers in industry. Despite having to decline most of the requests, he was still able to teach servlet and JSP short courses in Australia, Canada, Japan, Puerto Rico, the Philippines, and at dozens of U.S. venues. What fun!

Since then, use of servlets and JSP has continued to grow at a phenomenal rate. The Java 2 Platform has become the technology of choice for developing e-commerce applications, dynamic Web sites, and Web-enabled applications and service. Servlets and JSP continue to be the foundation of this platform--they provide the link between Web clients and server-side applications. Virtually all major Web servers for Windows, Unix (including Linux), MacOS, VMS, and mainframe operating systems now support servlet and JSP technology either natively or by means of a plugin. With only a small amount of configuration, you can run servlets and JSP in Microsoft IIS, the Apache Web Server, IBM WebSphere, BEA WebLogic, Oracle9i AS, and dozens of other servers. Performance of both commercial and open-source servlet and JSP engines has improved significantly.

However, the field continues to evolve rapidly. For example:

  • The official servlet and JSP reference implementation is no longer developed by Sun. Instead, it is Apache Tomcat, an open-source product developed by a team from many different organizations. So, we provide great detail on Tomcat configuration and usage.
  • Except for Tomcat, the servers popular when the book was first released are no longer widely used. So, we cover Macromedia JRun and Caucho Resin instead.
  • Version 2.4 of the servlet specification was released in late 2003. Many APIs have been added or have changed. So, we have upgraded the book to be consistent with these APIs.
  • Version 2.0 of the JSP specification was released (also late 2003). This version lets you use a shorthand expression language to access bean properties and collection elements. So, we cover both "classic" scripting and use of the JSP 2.0 expression language.
  • Two new versions of JDBC have been released, providing many useful new features. So, we explain database access in the context of these new features.
  • MySQL has emerged as a popular free database. So, we explain how to download, configure, and use MySQL (we also cover Oracle9i and Microsoft Access, of course).

Whew. Lots of action in the server-side Java community. Yup; and to reflect this fact, the book has been completely and totally rewritten from top to bottom. Many new capabilities are now covered. Experienced developer Larry Brown was brought in to add his expertise, especially in database applications. Many hard-learned lessons are explained in detail. Many techniques are now approached differently.

The new version provides a thorough and up-to-date introduction to servlet and JSP programming. We hope you find it useful.

Who Should Read This Book

This book is aimed at two main groups.

The primary audience is developers who are familiar with the basics of the Java programming language itself but have little or no experience with server-side applications. For you, virtually the entire book should be valuable; with the possible exception of the JSP 2.0 expression language (which is not applicable if you are using a server that is compliant only with JSP 1.2), you are likely to use capabilities from almost every chapter in almost every real-world application.

The second group is composed of people who are familiar with basic servlet and JSP development and want to learn how to make use of the new capabilities we just described. If you are in this category, you can skim many of the chapters, focusing on the capabilities that are new in servlets 2.4, JSP 2.0, or JDBC 3.0.

Although this book is well suited for both experienced servlet and JSP programmers and newcomers to the technology, it assumes that you are familiar with basic Java programming. You don't have to be an expert Java developer, but if you know nothing about the Java programming language, this is not the place to start. After all, servlet and JSP technology is an application of the Java programming language. If you don't know the language, you can't apply it. So, if you know nothing about basic Java development, start with a good introductory book like Thinking in Java, Core Java, or Core Web Programming. Come back here after you are comfortable with at least the basics.

Volume 2

This first volume of the book focuses on core technologies: the servlet and JSP capabilities that you are likely to use in almost every real-life project. The second volume focuses on advanced capabilities: features that you use less frequently but that are extremely valuable in complex applications.

These topics include servlet and JSP filters, declarative and programmatic Web application security, custom tag libraries, the JSP Standard Tag Library (JSTL), Apache Struts, JavaServer Faces (JSF), Java Architecture for XML Binding (JAXB), database connection pooling, advanced JDBC features, and use of Ant for deployment.

For information on the release date of Volume 2, please see the book's Web site at <http://www.coreservlets.com/>.

Distinctive Features

This book has five important characteristics that set it apart from many other similar-sounding books:

  • Integrated coverage of servlets and JSP. The two technologies are closely related; you should learn and use them together.
  • Real code. Complete, working, documented programs are essential to learning; we provide lots of them.
  • Step-by-step instructions. Complex tasks are broken down into simple steps that are illustrated with real examples.
  • Server configuration and usage details. We supply lots of concrete examples to get you going quickly.
  • Design strategies. We give lots of experience-based tips on best approaches and practices.
Integrated Coverage of Servlets and JSP

One of the key philosophies behind Core Servlets and JavaServer Pages is that servlets and JSP should be learned (and used!) together, not separately. After all, they aren't two entirely distinct technologies: JSP is just a different way of writing servlets. If you don't know servlet programming, you can't use servlets when they are a better choice than JSP, you can't use the MVC architecture to integrate servlets and JSP, you can't understand complex JSP constructs, and you can't understand how JSP scripting elements work (since they are really just servlet code). If you don't understand JSP development, you can't use JSP when it is a better option than servlet technology, you can't use the MVC architecture, and you are stuck using print statements even for pages that consist almost entirely of static HTML.

Servlets and JSP go together! Learn them together!

Real Code

Sure, small code snippets are useful for introducing concepts. The book has lots of them. But, for you to really understand how to use various techniques, you also need to see the techniques in the context of complete working programs. Not huge programs: just ones that have no missing pieces and thus really run. We provide plenty of such programs, all of them documented and available for unrestricted use at <http://www.coreservlets.com>.

Step-by-Step Instructions

When Marty was a Computer Science graduate student (long before Java existed), he had an Algorithms professor who stated in class that he was a believer in step-by-step instructions. Marty was puzzled: wasn't everyone? Not at all. Sure, most instructors explained simple tasks that way, but this professor took even highly theoretical concepts and said "first you do this, then you do that," and so on. The other instructors didn't explain things this way; neither did his textbooks. But, it helped Marty enormously.

If such an approach works even for theoretical subjects, how much more should it work with applied tasks like those described in this book?

Server Configuration and Usage Details

When Marty first tried to learn server-side programming, he grabbed a couple of books, the official specifications, and some online papers. Almost without fail, they said something like "since this technology is portable, you need to read your server's documentation to know how to execute servlets or JSP pages." Aargh! He couldn't even get started. After hunting around, he downloaded a server. He wrote some code. How did he compile it? Where did he put it after it was compiled? How did he invoke it? How about some help here?

Servlet and JSP code is portable. The APIs are standardized. But, server structure and organization are not standardized. The directory in which you place your code is different on Tomcat than it is on JRun. You set up Web applications differently with Resin than you do with other servers. These details are important.

Now, we're not saying that this is a book that is specific to any particular server. We're just saying that when a topic requires server-specific knowledge, it is important to say so. Furthermore, specific examples are helpful. So, when we describe a topic that requires server-specific information like the directory in which to place a Web application, we first explain the general pattern that servers tend to follow. Then, we give very specific details for three of the most popular servers that are available without cost for desktop development: Apache Tomcat, Macromedia JRun, and Caucho Resin.

Design Strategies

Sure, it is valuable to know what capabilities the APIs provide. And yes, syntax details are important. But, you also need the big picture. When is a certain approach best? Why? What gotchas do you have to watch out for? Servlet and JSP technology is not perfect; how should you design your system to maximize its strengths and minimize its weaknesses? What strategies simplify the long-term maintenance of your projects? What approaches should you avoid?

We're not new to servlet and JSP technology. We've been doing it for years. And, we've gotten feedback from hundreds of readers and students from Marty's training courses. So, we don't just show you how to use individual features; we explain how these features fit into overall system design and highlight best practices and strategies.

How This Book Is Organized

This book consists of three parts: servlet technology, JSP technology, and supporting technologies.

Part I: Servlet Technology

  • Downloading and configuring a free server
  • Setting up your development environment
  • Deploying servlets and JSP pages: some options
  • Organizing projects in Web applications
  • Building basic servlets
  • Understanding the servlet life cycle
  • Dealing with multithreading problems
  • Debugging servlets and JSP pages
  • Reading form parameters
  • Handling missing and malformed data
  • Dealing with incomplete form submissions
  • Using HTTP request headers
  • Compressing pages
  • Customizing pages based on browser types or how users got there
  • Manipulating HTTP status codes and response headers
  • Redirecting requests
  • Building Excel spread sheets with servlets
  • Generating custom JPEG images from servlets
  • Sending incremental updates to the user
  • Handling cookies
  • Remembering user preferences
  • Tracking sessions
  • Differentiating between browser and server sessions
  • Accumulating user purchases
  • Implementing shopping carts
Part II: JSP Technology
  • Understanding the need for JSP
  • Evaluating strategies for invoking Java code from JSP pages
  • Invoking Java code with classic JSP scripting elements
  • Using the predefined JSP variables (implicit objects)
  • Controlling code structure with the page directive
  • Generating Excel spread sheets with JSP pages
  • Controlling multithreading behavior
  • Including pages at request time
  • Including pages at compile time
  • Using JavaBeans components
  • Setting bean properties automatically
  • Sharing beans
  • Integrating servlets and JSP pages with the MVC architecture
  • Using RequestDispatcher
  • Comparing MVC data-sharing options
  • Accessing beans with the JSP 2.0 expression language
  • Using uniform syntax to access array elements, List items, and Map entries
  • Using expression language operators
Part III: Supporting Technologies
  • Accessing databases with JDBC
  • Simplifying JDBC usage
  • Using precompiled (parameterized) queries
  • Executing stored procedures
  • Controlling transactions
  • Using JDO and other object-to-relational mappings
  • Configuring Oracle, MySQL, and Microsoft Access for use with JDBC
  • Creating HTML forms
  • Surveying all legal HTML form elements
  • Debugging forms with a custom Web server
About the Web Site

The book has a companion Web site at <http://www.coreservlets.com/>. This free site includes:

  • Documented source code for all examples shown in the book; this code can be downloaded for unrestricted use
  • Links to all URLs mentioned in the text of the book
  • Up-to-date download sites for servlet and JSP software
  • Information on book discounts
  • Book additions, updates, and news
About the Training Courses

Hands-on JSP and servlet training courses based on the book are also available. These courses are personally developed and taught by the lead author of the book (Marty). Open-enrollment versions based on the first and second volumes are available at public venues; customizable on-site versions can also be taught at your organization. See <http://courses.coreservlets.com/> for details.

Read More Show Less

Customer Reviews

Be the first to write a review
( 0 )
Rating Distribution

5 Star

(0)

4 Star

(0)

3 Star

(0)

2 Star

(0)

1 Star

(0)

Your Rating:

Your Name: Create a Pen Name or

Barnes & Noble.com Review Rules

Our reader reviews allow you to share your comments on titles you liked, or didn't, with others. By submitting an online review, you are representing to Barnes & Noble.com that all information contained in your review is original and accurate in all respects, and that the submission of such content by you and the posting of such content by Barnes & Noble.com does not and will not violate the rights of any third party. Please follow the rules below to help ensure that your review can be posted.

Reviews by Our Customers Under the Age of 13

We highly value and respect everyone's opinion concerning the titles we offer. However, we cannot allow persons under the age of 13 to have accounts at BN.com or to post customer reviews. Please see our Terms of Use for more details.

What to exclude from your review:

Please do not write about reviews, commentary, or information posted on the product page. If you see any errors in the information on the product page, please send us an email.

Reviews should not contain any of the following:

  • - HTML tags, profanity, obscenities, vulgarities, or comments that defame anyone
  • - Time-sensitive information such as tour dates, signings, lectures, etc.
  • - Single-word reviews. Other people will read your review to discover why you liked or didn't like the title. Be descriptive.
  • - Comments focusing on the author or that may ruin the ending for others
  • - Phone numbers, addresses, URLs
  • - Pricing and availability information or alternative ordering information
  • - Advertisements or commercial solicitation

Reminder:

  • - By submitting a review, you grant to Barnes & Noble.com and its sublicensees the royalty-free, perpetual, irrevocable right and license to use the review in accordance with the Barnes & Noble.com Terms of Use.
  • - Barnes & Noble.com reserves the right not to post any review -- particularly those that do not follow the terms and conditions of these Rules. Barnes & Noble.com also reserves the right to remove any review at any time without notice.
  • - See Terms of Use for other conditions and disclaimers.
Search for Products You'd Like to Recommend

Recommend other products that relate to your review. Just search for them below and share!

Create a Pen Name

Your Pen Name is your unique identity on BN.com. It will appear on the reviews you write and other website activities. Your Pen Name cannot be edited, changed or deleted once submitted.

 
Your Pen Name can be any combination of alphanumeric characters (plus - and _), and must be at least two characters long.

Continue Anonymously
Sort by: Showing all of 2 Customer Reviews
  • Anonymous

    Posted October 17, 2004

    Top notch introduction to Web application programming in Java

    I have been using Java off and on over the last few years to create stand-alone applications. So I don't consider myself a Java expert, but I am quite comfortable with the technology. This book was exactly what I needed to start building Web applications in Java. Unlike most books in its category, this book is well written and easy to follow. I only wish Volume II, which is referenced quite a bit, was still in print. :-( All in all, this is a great book.

    Was this review helpful? Yes  No   Report this review
  • Anonymous

    Posted September 29, 2003

    The Full Monty for Server Side Development

    This book is aimed at what its authors see as a shortfall in java application development. In server side generation of dynamic web pages, java is the most commonly used language. Some developers emphasise using servlets and downplay Java Server Pages. Others do the opposite. If you troll various newsgroups, you can see arguments between the two views. What Hall and Brown posit is that this debate is a false dichotomy. They offer a deeper understanding of both, and how often you need to implement both in real applications. These have complementary attributes that together let you fully implement a Model-View-Controller architecture. That is one emphasis of the book. You should find it straightforward. But the other emphasis is, I believe, more useful. They show how to implement server side applications. Everything from choosing a web container like Tomcat, to showing how your app can accessing a back end SQL database like MySQL or Oracle. The full Monty, as it were. If you are casting around for how to build an online store, say, with a shopping cart and ease of use, and you have not built one before, or you need a fresh outlook, you should study carefully the examples. In the best case, you will find templates that you can immediately modify.

    Was this review helpful? Yes  No   Report this review
Sort by: Showing all of 2 Customer Reviews

If you find inappropriate content, please report it to Barnes & Noble
Why is this product inappropriate?
Comments (optional)