Once your students have Java skills like those presented in our core Java book, you can use our servlets and JSP book to teach them how to develop Java web applications. Dozens of schools have adopted this book, and what instructors like most is the book’s logical, straightforward approach and its comprehensive treatment of Tomcat, MySQL, JSP, and servlets. As one instructor put it, "Thanks to you, we no longer have to cobble together HTML, Tomcat, and JSP material."
You are currently on the Murach site for instructors. To buy this book, please visit our retail site.
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. The book finishes with a completed e-commerce example that builds on the earlier work, and gives the reader a basis for their own future development.”
In this section, your students will learn:
By the time your students finish with this section, they will be able to set up their own development environments for coding and running servlets and JSPs.
This section starts with a crash course in HTML, which is essential to the use of JSPs. Then, your students will learn the skills for creating servlets and JSPs that they’ll use in almost every application. These chapters move from the simple to the complex as they present the use of servlets, JSPs, sessions, cookies, JavaBeans, Expression Language (EL), the JSP Standard Tag Library (JSTL), and custom JSP tags.
Here, your students will learn how to use servlets and JSPs to work with a database using either JDBC or the newer JPA. Since MySQL is a popular open-source database that works well with Java and is commonly used for web applications, this section presents the details for working with MySQL. However, these principles can be applied to the use of any database management system, including Oracle and Microsoft SQL Server.
In this section, your students will learn the advanced servlet and JSP skills that are needed for certain types of web applications. This includes the use of JavaMail, SSL, authentication, encryption, advanced HTTP skills, listeners, and filters. Then, the last chapter is an introduction to creating web applications with JavaServer Faces (JSF), if you want to cover this alternative to using JSPs. Since the chapters in this section have been designed to work independently, you can assign as many as you want, in any order you want.
This section presents an e-commerce website that puts the skills presented in the first four sections into context. This downloadable application illustrates best practices and provides code that your students can use in their own 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:
This book assumes that your students have basic Java skills, the kind they should get from any core Java book or course, like chapters 1-14 of our own Murach’s Java Programming.
With a set of basic Java skills as the prerequisite, this book can be used for a first web programming course. Or it can be combined with our core Java book for a two- or three-term sequence. And if you want to teach SQL as part of that sequence, you can add Murach’s MySQL to the mix. Unlike the books of other publishers, all of these books are designed to work together.
To create and use the web applications in this book, your students need this software:
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 your students will need for doing that:
Because this book shows how to use the NetBeans IDE to develop servlets and JSPs, that’s the best IDE for a course that’s based on this book.
However, if you prefer to use another IDE such as Eclipse with this book, you can do that. You just need to:
"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. The problem-solving context is especially valuable, as it really drills the topic into one’s brain. It’s one thing to read about an API and see how it works; it’s another thing to see it being used to solve a common business process or problem....In short, I cannot recommend Murach’s Java Servlets and JSP 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
"This book is very practical, and it will make Servlets and JSP fun to learn. It is so enjoyable that you’ll finish reading it in no time. I wish I had such a book when I started developing web applications. Highly recommended."
- Christophe Verre, JavaRanch.com
"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 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 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
"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
“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. The book finishes with a completed e-commerce example that builds on the earlier work, and gives the reader a basis for their own future development.”
- Posted on Amazon
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
If you aren’t already familiar with the supporting courseware that we provide for a book, please go to About our Courseware. As you will see, our courseware consists of the end-of-chapter activities in the book, the files in the student download at our retail site, and the instructor’s materials. These components provide everything that other publishers provide in a way that delivers better results.
If you are familiar with our courseware, here’s a quick summary of the courseware for this book. For a detailed description in PDF format, please read the Instructor’s Summary.
In the book, appendix A (for Windows) and appendix B (for Mac) give your students complete instructions for downloading and installing these items on their own systems.
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!
This is our site for college instructors. To buy Murach books, please visit our retail site.