Head First Servlets & JSP, Second Edition
This page is for the second edition of Head First Servlets & JSP. For the first edition, see this page.
Looking to study up for the new J2EE 1.5 Sun Certified Web Component Developer (SCWCD) exam? Head First Servlets and JSP doesn't just give you a bunch of facts to memorize; it drives knowledge straight into your brain. You'll interact with servlets and JSPs in ways that help you learn quickly and deeply. And when you're through with the book, you can take a brand-new mock exam, created specifically to simulate the real test-taking experience.
This book will get you way up to speed on the technology you'll know it so well, in fact, that you can pass the brand new J2EE 1.5 exam. If that's what you want to do, that is. Maybe you don't care about the exam, but need to use servlets and JSPs in your next project. You're working on a deadline. You're over the legal limit for caffeine. You can't waste your time with a book that makes sense only AFTER you're an expert (or worse, one that puts you to sleep).
Learn how to write servlets and JSPs, what makes a web container tick (and what ticks it off), how to use JSP's Expression Language (EL for short), and how to write deployment descriptors for your web applications. Master the c:out tag, and get a handle on exactly what's changed since the older J2EE 1.4 exam. You don't just pass the new J2EE 1.5 SCWCD exam, you'll understand this stuff and put it to work immediately.
Head First Servlets and JSP doesn't just give you a bunch of facts to memorize; it drives knowledge straight into your brain. You'll interact with servlets and JSPs in ways that help you learn quickly and deeply. And when you're through with the book, you can take a brand-new mock exam, created specifically to simulate the real test-taking experience.
See this page for a note from the editor regarding our decision to do a second edition of this book.
Book code and downloads
Read Me: What you need for this book
Besides your brain and a pencil, you need Java, Tomcat 5, and a computer.
You do not need any other development tool, such as an Integrated Development Environment (IDE). We strongly recommend that you not use anything but a basic editor until you complete this book. A servlet/JSP-aware IDE can protect you from some of the details that really matter (and that you'll be tested on), so you're much better off developing the bean code completely by hand. Once you really understand what's happening, you can move to a tool that automates some of the servlet/JSP creation and deployment steps. If you already know how to use Ant, then after chapter 3, you can switch to using it to help you deploy, but we don't recommend using Ant until after you've completely memorized the web app deployment structure.
- If you don't already Java SE v1.5 or greater, you'll need it.
- If you don't already have Tomcat 5, go get it.
Select "Tomcat v5.5" in the Downloads menu on the left side of the home page.
- Scroll down to the "Binary Distributions" section and download the version of your choice. If you do not know, then select the "Core" distribution; it is all you need.
- Save the installation file in a temporary directory.
- Install Tomcat.
For Windows, that means double-clicking the install .exe file and following the installer wizard instructions. For the others, unpack the install file into the place on your hard drive where you want Tomcat to be.
- To make it easier to follow the book instructions, name the Tomcat home directory "tomcat" (or set up a "tomcat" alias to the real Tomcat home).
- Set environment variables for JAVA_HOME and TOMCAT_HOME, in whatever way you normally set them for your system.
- You should have a copy of the specs, although you do not need them in order to pass the exam. At the time of this writing, the specs are here:
Servlet 2.4 (JSR #154)
JSP 2.0 (JSR #152)
JSTL 1.1 (JSR #52)
Go to the JSR page and click on the Download Page for the final release.
- Test Tomcat by launching the tomcat/bin/startup script (which is startup.sh) for Linux/Unix/OS X. Point your browser to: http://localhost:8080/ and you'll see the Tomcat welcome page.
Last-minute things you need to know:
Take the final Coffee Cram Mock Exam only AFTER you finish the book.
If you take it too soon, you won't get a clear picture of how ready you are for the exam. Wait until you think you're close to ready, then take the exam, giving yourself exactly 135 minutes—the length of the real SCWCD.
We use simple UML-like diagrams.
Although there's a good chance you already know UML, it's not covered on the exam, and it's not a prerequisite for the book. So you won't have to worry about learning servlets, JSP, JSTL and UML at the same time.
We don't cover every single picky detail from the spec.
The exam is pretty detailed, though, and so are we. But if there's a detail in the spec that's not covered in the exam, we don't talk about it unless it's important to most component developers. What you need to know to begin developing web components (servlets and JSPs), and what you need to pass the exam, overlap about 85%. We cover a few things not on the exam, but we point them out so you don't have to try to memorize them. We created the real exam, so we know where you should focus your energy! If there's a chance that this one picky detail might be on one question on the exam, but the effort to learn it isn't really worth it, we might skip it, or cover it only very lightly, or only in a mock exam question.
(opens a new window)
(opens a new window)
Buy 2 books and get the third free! Use the coupon code OPC10 when you check out.
If you can answer "yes" to all of these:
- Do you know how to program in Java (you don't need to be a guru)?
- Do you like to tinker—do you learn by doing, rather than just reading? Do you want to learn, understand, and remember servlets and JSPs, and pass the SCWCD for Java EE 1.5 exam?
- Do you prefer stimulating dinner party conversation to dry, dull, academic lectures?
You should probably back away from this book if you can answer "yes" to any of these:
- Are you completely new to Java? You don't need to be an advanced programmer, but if you don't have any experience, go pick up a copy of Head First Java, right now, and then come back to this book.
- Are you a kick-butt Java programmer looking for a reference book?
- Are you a Java EE veteran looking for ultra-advanced server techniques, server-specific how-to's, enterprise architecture, and complex, robust, real-world code?
- Are you afraid to try something different? Would you rather have a root canal than mix stripes with plaid? Do you believe that a technical book can't be serious if Java components are anthropomorphized?