Our Ironclad Guarantee
You must be satisfied. Try our print books for 30 days or our eBooks for 14 days. If they aren't the best you've ever used, you can return the books or cancel the eBooks for a prompt refund. No questions asked!
From the start, servlets and JSPs have been a training problem because web programming with them requires so many different skills and so much conceptual background. But the first edition of this book solved that training problem: It presented the critical skills in the right order with plenty of examples, allowing developers to master all the complexities in a manageable way.
Now, this improved and updated 3rd Edition makes it even easier and faster for you to learn. And to prove to yourself that you will master all the servlet and JSP skills that you need to develop e-commerce applications, you can download the book’s e-commerce website that ties all the skills together.
Go to our instructor’s site to learn more about this book and its instructor’s materials.
I have to admit I was a bit intimidated by JSP and servlets. But Murach's treatment of the topic is excellent. It goes step-by-step, starting with simple examples, but the pace doesn't feel overly slow. You always feel like you're making good progress.... Overall, a great book."
This book is for anyone who wants to develop professional websites using Java servlets and JSPs. The only prerequisite is a basic understanding of the Java programming language, roughly equivalent to chapters 1 through 14 of our core Java book, Murach’s Java Programming. But you don’t need any web programming experience at all.
In this section, you’ll learn:
By the time you’re through with this section, you’ll be ready to use the IDE to code and run servlets and JSPs on your own computer.
In this section, you’ll get a crash course in HTML and CSS, which are essential to the use of JSPs. Then, you’ll learn the skills for creating servlets and JSPs that you’ll use in almost every application. These chapters move from the simple to the complex as you learn how to work with servlets, JSPs, sessions, cookies, JavaBeans, Expression Language (EL), the JSP Standard Tag Library (JSTL), and custom JSP tags.
Here, you’ll learn how to use both JDBC (Java Database Connectivity) and JPA (Java Persistence API) to work with a database. Although this section focuses on the use of MySQL databases, JDBC and JPA can be used for working with any database management system, including Oracle and SQL Server.
In this section, you’ll learn the advanced servlet and JSP skills that you will need for certain types of web applications. This includes the use of JavaMail, SSL, authentication, encryption, HTTP, listeners, and filters. Then, the last chapter in this section shows you how to use JavaServer Faces, which is an alternative to using JSPs.
Since the chapters in this section have been designed to work independently of each other, you can read them in any order you want. This makes it easy for you to learn new skills whenever you need them.
This section presents an e-commerce website that puts the skills in the first four sections into context. This downloadable application illustrates best practices and provides code that you can use in your own applications. Once you understand how this website works, you will have all the skills you need for creating your own web applications.
Like all our books, this one has features that you won’t find in competing books. Here, though, are a few of the features that are unique to this book:
To create and use the web applications in this book, you need to install this software on your PC:
This software is available for Windows, Mac OS X, and Linux systems.
Although all of this software is free, it can be difficult to install and get started with it. So this book provides all the support you need for doing that if you’re working on a Windows or Mac system:
If you’re using a Linux system, we assume that you’ll be able to install this software on your own. If not, you can use appendix B as a general guide and use the Internet to get any other information that you need.
Murach’s Java Programming is the perfect companion to our Servlets and JSP book. It presents all the Java skills that you need for using servlets and JSP. It lets you learn new Java skills whenever you need them. And it’s the best on-the-job Java reference that money can buy.
Murach’s HTML and CSS is a book that every web developer should have. It will help you expand your HTML and CSS skills in a professional way whenever you have some extra time. It covers today’s best practices for using HTML and CSS. And it will answer your HTML and CSS questions as they arise.
Today, knowing a server-side language is not enough to be a top web developer. So Murach’s JavaScript and jQuery teaches you how to write client-side code for your web pages to enhance the user experience. Another great book for training and on-the-job reference.
If you use MySQL or Oracle Database with your web applications, you’ll want to have a copy of Murach’s MySQL or Murach’s Oracle SQL and PL/SQL at your side. Each book is a complete course in the SQL and database administration skills you need as a web developer.
“This is an excellent tutorial that will painlessly teach you how to write complex web applications. I doubt that there is another book available that makes the subject this easy to understand.”
-- Thomas Paul, JavaRanch.com
"I love the layout, style, organization, thoroughness, ease of understanding, and overall excellence of the Murach books. They explain everything very clearly, step by step, in a mentor/instructor conversational style, and in a problem-solving context…. In short, I cannot recommend Murach’s Java Servlets and JSP (2nd Edition) enough. This book is a pleasure to read, and I’ve learned a ton, and solidified my knowledge and skills regarding Java web development.
“Get it. You’ll like it. It’s well worth the price tag."
--Jeff Salter, TheServerSide.com
"I have to admit I was a bit intimidated by JSP and servlets. But Murach’s treatment of the topic is excellent. It goes step-by-step, starting with simple examples, but the pace doesn’t feel overly slow. You always feel like you’re making good progress.... Overall a great book."
--Posted at an online bookseller
"I’ve read a lot of computer technology books, and rarely have I felt so solidly prepared as this one to transfer what I’ve learned into real projects."
--Posted at an online bookseller
"A very strong point your book has is putting crystal-clear comments on the left page, with short but realistic examples and a summary on the right. The idea is simple, but very efficient: it allowed me to progress at light speed and still proves to be very convenient when I need to refresh my memory within seconds. It makes me a more productive programmer. Very good index, too!"
--Xavier Mercier, Software Designer, Galway, Ireland
"I have been a developer for over 10 years in many different languages and usually for each language or topic I buy lots of books, most of which, sad to say, are fairly boring, overly complex, teach useless stuff, or are way too cluttered and disorganized to get the points across. Usually I find a couple of books that really stand out and become tattered and ragged with use. This is such a book."
--Posted at an online bookseller
"Every so often you find a technical book that is so superbly written you actually enjoy reading it, because you know you’re going to be able to understand and learn more each time you pick it up. From the start of this book, through to the end, I found myself feeling so glad I found this book and so grateful to the authors, because the care and skill with which it was written makes it very easy to read and understand."
--Posted at an online bookseller
“This book takes you through a well-structured learning journey of JSP, Servlets, and related technologies such as Netbeans, Tomcat and MySQL for developing complete web apps. The book has provided me with the skill and confidence to start building my own web-app.”
-- Posted at an online bookseller
"There is a line written on this book, ‘No other book teaches you so much, so fast, so thoroughly,’ and I must tell you that this is 100% correct. Congrats !! on coming up with this amazing work of yours.... Looking forward to more books on other languages as well."
--Ravi Nathani, Software Engineer Wireless and Multimedia Products
View the table of contents for this book in a PDF: Table of Contents (PDF)
Click on any chapter title to display or hide its content.
A typical web application
The components of a web application
How static web pages work
How dynamic web pages work
Servlet/JSP
JSF
Spring Framework
The software components
The architecture
The standard directories and files
IDEs for developing Java web applications
Web servers for Java web applications
Database servers for Java web applications
Tools for deploying Java web applications
The Model 1 pattern
The Model 2 (MVC) pattern
The user interface
The HTML for the first page
The CSS for both web pages
The servlet for the back-end processing
The web.xml file
The User class
The JSP for the second page
How to start NetBeans
How to create a new web application
How to use the Projects window
How to open and close projects
How to build, deploy, and run a web application
How to add an HTML or JSP file
How to edit an HTML or JSP file
How to add a Java class
How to add a servlet
How to edit a Java file
How to edit the web.xml file
How to edit other XML files
How to add existing files to a project
How to deploy a web application to a remote server
How to work with a web application server
How to add a class library or a JAR file to a project
How to register a database connection
The starting HTML for a web page
How to code HTML elements
How to use the HTML5 semantic elements
How to use the div and span elements with HTML5
How to ensure cross-browser compatibility
How to code links
How to include images
How to code tables
How to provide CSS styles for an HTML page
How to code the basic CSS selectors
How to code CSS rule sets and comments
How to use CSS to format a table
How to code a form
How to code text boxes
How to code buttons
How to code check boxes and radio buttons
How to code combo boxes and list boxes
How to create a servlet
How to map a servlet with the web.xml file
How to map a servlet with an annotation
How to use the HTTP GET method
How to use the HTTP POST method
When to use the HTTP GET and POST methods
How to get the values of the parameters
How to get the real path for a file
How to get and set request attributes
How to forward requests
How to redirect responses
How to validate data on the client
How to validate data on the server
A complete web.xml file
How to work with initialization parameters
How to implement custom error handling
How the methods of a servlet work
Why you shouldn’t use instance variables in servlets
How to solve common servlet problems
How to print debugging data to the console
How to print debugging data to a log file
How to code a JavaBean
How to use EL to get attributes and JavaBean properties
How to enable the core JSTL library
How to use the JSTL if tag
How to code directives, scriptlets, and expressions
How to code comments in a JSP
An introduction to standard JSP tags
How to code the useBean tag
How to code the getProperty and setProperty tags
A JSP that includes a header and footer file
Three techniques for including files in a JSP
Why session tracking is difficult with HTTP
How session tracking works in Java
An application that needs session tracking
How to set and get session attributes
More methods of the session object
How to provide thread-safe access to the session object
An introduction to cookies
How to create and use cookies
How to view and delete cookies
Four methods for working with cookies
A utility class for working with cookies
How to use URL rewriting to pass parameters
How to use hidden fields to pass parameters
The user interface
The file structure
The web.xml file
The code for the JSPs
The code for the servlet
Advantages of EL
Disadvantages of EL
How to use the dot operator to work with JavaBeans and maps
How to use EL to specify scope
How to use the [ ] operator to work with arrays and lists
How to use the dot operator to access nested properties
How to use the [ ] operator to access attributes
How to work with the other implicit EL objects
How to work with other EL operators
How to disable EL
How to disable scripting
The JSTL libraries
How to make the JSTL JAR files available to your application
How to code the taglib directive
How to code a JSTL tag
How to view the documentation for a library
How to use the out tag
How to use the forEach tag
How to use the forTokens tag
Four more attributes for looping
How to use the if tag
How to use the choose tag
How to use the url tag
Other tags in the JSTL core library
The user interface
The code for the business classes
The code for the servlets and JSPs
The tag
The tag element
The tag class
The tag
The tag element
The tag class
The tag
The tag element
The tag class
The tag
The tag element
The tag class
An introduction to scripting variables
The TEI class for four scripting variables
Methods and fields of the TagSupport class
Methods and fields of the PageContext class
Methods and fields of the BodyTagSupport class
Methods and fields of the BodyContent class
What MySQL provides
Two ways to interact with MySQL
The Home tab of MySQL Workbench
How to open a database connection
How to start and stop the MySQL server
How to enter and execute a SQL statement
How to enter and execute a SQL script
How to create, select, and drop a database
How to create and drop a table
How to insert multiple rows into a table
How to select data from a single table
How to select data from multiple tables
How to insert, update, and delete data
An introduction to database drivers
How to connect to a database
How to return a result set and move the cursor through it
How to retrieve data from a result set
How to insert, update, and delete data
How to work with prepared statements
The user interface
The code for the JSP
The code for the servlet
The code for the utility class
How connection pooling works
How to make a connection pool available
How to implement a connection pool
How to use a connection pool
The user interface
The code for the JSP
The code for the servlet
The code for the database class
The code for the utility class
A summary of JPA implementations
Entities and the entity manager
How to configure NetBeans to work with JPA
How to configure a persistence unit
How to code the class for an entity
How to use getter and field annotations
How to code relationships between entities
How to work with dates and times
How to get an entity manager factory
How to retrieve an entity by primary key
How to retrieve multiple entities
How to retrieve a single entity
How to insert, update, or delete a single entity
How to update or delete multiple entities
The methods that modify data
The methods that retrieve data
How email works
How to install the JavaMail API
Code that uses the JavaMail API to send an email message
How to create a mail session
How to create a message
How to address a message
How to send a message
A helper class for sending an email with a local SMTP server
A servlet that uses a helper class to send an email message
A helper class for sending an email with a remote SMTP server
How SSL works
How TLS works
When to use a secure connection
How SSL authentication works
How to get a digital secure certificate
How to create a certificate for testing
How to enable SSL in Tomcat
How to test a local SSL connection
How to request a secure connection
A JSP that uses a secure connection
How to return to a regular HTTP connection
How to switch from a local system to an Internet server
How container-managed authentication works
Three types of authentication
How to add a security role
How to add a security constraint
How to implement the UserDatabaseRealm
How to implement the JDBCRealm
How to implement the DataSourceRealm
How to use basic authentication
How to use digest authentication
How to use form-based authentication
Common website attacks
How to prevent social engineering attacks
An introduction to cryptography
Common password attacks
How to hash passwords
How to salt passwords
A utility class for hashing and salting passwords
How to enforce password strength requirements
An HTTP request and response
Common MIME types
Common HTTP request headers
Common HTTP status codes
Common HTTP response headers
How to get a request header
How to display all request headers
How to set status codes
How to set response headers
How to return a spreadsheet
How to control caching
How to compress a response with GZIP
How to return a binary file as an attachment
How to create virtual HTML pages
How to code a class for the listener
How to register the listener
How to code a JSP that uses the attributes set by the listener
A summary of the listener interfaces
The methods of the listener interfaces
The methods of the event objects
How filters work
Two benefits of filters
When to use filters
How to code a filter
How to configure a filter
How to code a filter that performs request-side processing
How to code a filter that performs response-side processing
How to wrap a request or response
How to use an initialization parameter
How to restrict access by IP address
A summary of JSF versions
How to add a JSF library to a project
How to create a managed bean
How to set the scope of a bean
How to code the head and body tags
How to display data from a managed bean
How to code the inputText tag
How to validate data
How to code a form action
The user interface
The EmailList bean
The index.xhtml file
The thanks.xhtml file
The Home and Catalog pages
The code for the Home page
The class diagrams
The Product class
The CatalogController class
The directory structure
The web.xml file
The context.xml file
The database diagram
The SQL script for the database
The class diagrams
The ProductDB class
The similarities
The differences
The Download application
The Cart application
The Admin Login page
The Admin Menu page
The Process Invoices application
The Reports application
How to install the source code for this book
How to install the JDK
How to install NetBeans
How to install Tomcat
How to configure a Tomcat server
How to test NetBeans and Tomcat
How to install MySQL
How to create the databases for this book
How to restore the databases for this book
How to install the source code for this book
How to install the JDK
How to install NetBeans
How to install Tomcat
How to configure a Tomcat server
How to test NetBeans and Tomcat
How to install the MySQL Community Server
How to install MySQL Workbench
How to create the databases for this book
How to restore the databases for this book
How to update the password for the root user
This chapter introduces you to the terms and concepts that you need for working with Java servlets and JavaServer Pages (JSPs).
This chapter shows how to use the MVC pattern (or Model 2 architecture) to get the most from JSPs and servlets. From that point on, you’ll use servlets when they’re appropriate and JSPs when they’re appropriate.
Chapter 1 PDF (1.3Mb) Download Now
Chapter 2 PDF (0.5Mb) Download Now
This download includes:
Appendix A for Windows users and appendix B for Mac users show how to install and use these files.
Exe file for Windows (21.1Mb) Download Now
Zip file for any system (21.0Mb) Download Now
Because we use the NetBeans IDE throughout our Servlets and JSP book, the downloadable files are arranged in the directory and file structure that NetBeans requires.
However, you can use another IDE like Eclipse with this book. In that case, you’ll just need to convert the NetBeans directory and file structure so it’s appropriate for your IDE.
Below are the answers to the questions that have come up most often about this book. If you have any questions that aren't answered here, please email us. Thanks!
This error is occurring because you have installed MySQL 8.0 or later. Unfortunately, the NetBeans projects for this book use Connector/J drivers that are designed to work with MySQL 5.x. The easiest way to fix this problem is to uninstall MySQL 8.0 and install an earlier version of MySQL such as MySQL 5.7.
This error is occurring because you have installed MySQL 8.0 or later. Unfortunately, the NetBeans projects for this book use Connector/J drivers that are designed to work with MySQL 5.x. The easiest way to fix this problem is to uninstall MySQL 8.0 and install an earlier version of MySQL such as MySQL 5.7.
To view the corrections for this book in a PDF, just click on this link: View the corrections
Then, if you find any other errors, please email us, so we can correct them in the next printing of the book. Thank you!
For orders and customer service:
1-800-221-5528
Weekdays, 8 to 4 Pacific Time
If you're a college instructor who would like to consider a book for a course, please visit our website for instructors to learn how to get a complimentary review copy and the full set of instructional materials.