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

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

ISBN-10:
0130092290
ISBN-13:
9780130092298
Pub. Date:
08/26/2003
Publisher:
Pearson
ISBN-10:
0130092290
ISBN-13:
9780130092298
Pub. Date:
08/26/2003
Publisher:
Pearson
Core Servlets and JavaServer Pages: Volume 1: Core Technologies / Edition 2

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

$69.99
Current price is , Original price is $69.99. You
$69.99 
  • SHIP THIS ITEM
    Temporarily Out of Stock Online
  • PICK UP IN STORE

    Your local store may have stock of this item.

$45.40  $69.99 Save 35% Current price is $45.4, Original price is $69.99. You Save 35%.
  • SHIP THIS ITEM

    Temporarily Out of Stock Online

    Please check back later for updated availability.

    Note: Access code and/or supplemental material are not guaranteed to be included with used textbook.

Overview

Marty Hall's Core Servlets and JavaServer Pages was the number 1 servlet/JSP book in 2000 — helping over 100,000 Java developers master the power of Java server-side programming to Web-enable an extraordinary range of applications. Now, Hall takes the next step, bringing together even more powerful servlet/JSP techniques. The second edition of Core Servlets and JavaServer Pages provides a complete introduction to the technology, completely updated for JSP 2.0, servlets 2.4, the JSP Standard Tag Library (JSTL), and Java 1.4. This book serves both beginning and advanced developers. For beginning servlet and JSP developers, the book provides clear step-by-step coverage of the basic topics. For programmers already experienced with servlet and JSP technology, the book provides in-depth discussion of advanced topics, complete coverage of newly introduced capabilities, and practical design strategies. J2EE technology is the leading technology for building Web applications and services, and servlet and JSP technology is the heart of the J2EE platform. Servlets and JSP are the most popular way to build Web applications: every Java and Web developer needs to know this. JSP 2.0 will fundamentally change how servlet and JSP technology is used, so even experienced developers need to read this book!


Product Details

ISBN-13: 9780130092298
Publisher: Pearson
Publication date: 08/26/2003
Series: Sun Core Series
Edition description: REV
Pages: 736
Product dimensions: 7.10(w) x 9.40(h) x 1.80(d)

About 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.

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.

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.

From the B&N Reads Blog

Customer Reviews