Bryan Basham, Kathy Sierra, Bert Bates
Head First Servlets and JSP
Passing the Sun Certified Web Component Developer Exam
Bryan Basham, Kathy Sierra, Bert Bates
Head First Servlets and JSP
Passing the Sun Certified Web Component Developer Exam
- Broschiertes Buch
- Merkliste
- Auf die Merkliste
- Bewerten Bewerten
- Teilen
- Produkt teilen
- Produkterinnerung
- Produkterinnerung
Imagine a world without eBay...unthinkable! How would you get that Farrah Fawcett poster, retired Beanie Baby, or first-edition pet rock? Handling over a gazillion (OK, we exaggerate--it's actually only 1 billion) page views each day, server-side Java makes eBay work.Isn't it time you learned the latest (J2EE 1.4) versions of Servlets&JSPs? 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 Sun Certified Web Component Developer (SCWCD) 1.4 exam. If that's what you want to do, that is. Maybe you don't care about the exam, but need to…mehr
Andere Kunden interessierten sich auch für
- Bruce W. PerryJava Servlet and JSP Cookbook44,99 €
- Lennart JorelidJ2ee Frontend Technologies51,99 €
- Kathy SierraHead First EJB39,99 €
- John HuntGuide to J2ee: Enterprise Java123,99 €
- John HuntGuide to J2EE: Enterprise Java83,99 €
- Giulio ZambonBeginning Jsp, Jsf and Tomcat Web Development35,99 €
- Meeraj M. KunnumpurathPro J2EE 1.448,99 €
-
-
-
Imagine a world without eBay...unthinkable! How would you get that Farrah Fawcett poster, retired Beanie Baby, or first-edition pet rock? Handling over a gazillion (OK, we exaggerate--it's actually only 1 billion) page views each day, server-side Java makes eBay work.Isn't it time you learned the latest (J2EE 1.4) versions of Servlets&JSPs? 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 Sun Certified Web Component Developer (SCWCD) 1.4 exam. If that's what you want to do, that is. Maybe you don't care about the exam, but need to use Servlets&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).No problem. Head First Servlets and JSP's brain-friendly approach drives the knowledge straight into your head (without sharp instruments). You'll interact with servlets and JSPs in ways that help you learn quickly and deeply. It may not be The Da Vinci Code, but quickly see why so many reviewers call it "a page turner". Most importantly, this book will help you use what you learn. It won't get you through the exam only to have you forget everything the next day.Learn to write servlets and JSPs, what makes the Container tick (and what ticks it off), how to use the new JSP Expression Language (EL), what you should NOT write in a JSP, how to write deployment descriptors, secure applications, and even use some server-side design patterns. Can't talk about Struts at a cocktail party? That'll change. You won't just pass the exam, you will truly understand this stuff, and you'll be able to put it to work right away.This new exam is tough--much tougher than the previous version of the SCWCD. The authors of Head First Servlets and JSP know: they created it. (Not that it EVER occurred to them that if they made the exam really hard you'd have to buy a study guide to pass it.) The least they could do is give you a stimulating, fun way to pass the thing. If you're one of the thousands who used Head First EJB to pass the SCWCD exam, you know what to expect!
Hinweis: Dieser Artikel kann nur an eine deutsche Lieferadresse ausgeliefert werden.
Hinweis: Dieser Artikel kann nur an eine deutsche Lieferadresse ausgeliefert werden.
Produktdetails
- Produktdetails
- Verlag: O'Reilly Media
- 2nd ed.
- Seitenzahl: 911
- Erscheinungstermin: 29. April 2008
- Englisch
- Abmessung: 235mm x 205mm x 48mm
- Gewicht: 1638g
- ISBN-13: 9780596516680
- ISBN-10: 0596516681
- Artikelnr.: 23161793
- Herstellerkennzeichnung
- Libri GmbH
- Europaallee 1
- 36244 Bad Hersfeld
- 06621 890
- Verlag: O'Reilly Media
- 2nd ed.
- Seitenzahl: 911
- Erscheinungstermin: 29. April 2008
- Englisch
- Abmessung: 235mm x 205mm x 48mm
- Gewicht: 1638g
- ISBN-13: 9780596516680
- ISBN-10: 0596516681
- Artikelnr.: 23161793
- Herstellerkennzeichnung
- Libri GmbH
- Europaallee 1
- 36244 Bad Hersfeld
- 06621 890
Bryan Basham is a Software Architect and Developer with extensive experience in Java web technologies. He has a keen eye for identifying core, reusable modules and crafting effective interfaces between subsystems. He has excellent OO analysis and design skills and quickly learn new domains. He is also skilled in information architecture and UI design.
Praise for Head First Servlets and JSP(TM)
Praise for the Head First approach
Perpetrators of the Head First series (and this book)
How to Use this Book: Intro
Who is this book for?
We know what you're thinking.
And we know what your brain is thinking
Metacognition: thinking about thinking
Here's what WE did
Here's what YOU can do to bend your brain into submission
What you need for this book
Last-minute things you need to know
About the SCWCD (for Java EE 1.5) exam
Beta testers & technical reviewers
Other people to : credit
Even more peopleThe large number of acknowledgments is because we're testing the theory that everyone mentioned in a book acknowledgment will buy at least one copy, probably more, what with relatives and everything. If you'd like to be in the acknowledgments of our next book, and you have a large family, write to us.
Chapter 1: Intro and Overview: Why use Servlets & JSPs?
1.1 Everybody wants a web site
1.2 What does your web server do?
1.3 What does a web client do?
1.4 Clients and servers know HTML and HTTP
1.5 Two-minute HTML guide
1.6 What you write... (the HTML)
1.7 What the browser creates...
1.8 What is the HTTP protocol?
1.9 HTML is part of the HTTP response
1.10 If that's the response, what's in the request?
1.11 GET is a simple request, POST can send user data
1.12 It's true... you can send a little data with HTTP GET
1.13 Anatomy of an HTTP GET request
1.14 Anatomy of an HTTP POST request
1.15 Anatomy of an HTTP response, and what the heck is a "MIME type"?
1.16 All the pieces. On one page.
1.17 URL. Whatever you do, don't pronounce it "Earl".
1.18 Directory structure for a simple Apache web site
1.19 Web servers love serving static web pages
1.20 But sometimes you need more than just the web server
1.21 Two things the web server alone won't do
1.22 The non-Java term for a web server helper app is "CGI" program
1.23 Servlets Demystified (write, deploy, run)
1.24 JSP is what happened when somebody introduced Java to HTML
Chapter 2: High-Level Overview: Web App Architecture
2.1 What is a Container?
2.2 What if you had Java, but no servlets or Containers?
2.3 What does the Container give you?
2.4 How the Container handles a request
2.5 How it looks in code (what makes a servlet a servlet)
2.6 You're wondering how the Container found the Servlet...
2.7 A servlet can have THREE names
2.8 Using the Deployment Descriptor to map URLs to servlets
2.9 But wait! There's more you can do with the DD
2.10 Story: Bob Builds a Matchmaking Site
2.11 He starts to build a bunch of servlets... one for each page
2.12 But then it gets ugly, so he adds JSPs
2.13 But then his friend says, "You ARE using MVC, right?"
2.14 The Model-View-Controller (MVC) Design Pattern fixes this
2.15 Applying the MVC pattern to the matchmaking web app
2.16 But then his friend Kim takes a look
2.17 Is there an answer?
2.18 A "working" Deployment Descriptor (DD)
2.19 How J2EE fits into all this
Chapter 3: Hands-on MVC: Mini MVC Tutorial
3.1 Let's build a real (small) web application
3.2 The User's View of the web application-a Beer Advisor
3.3 Here's the architecture...
3.4 Creating your development environment
3.5 Creating the deployment environment
3.6 Our roadmap for building the app
3.7 The HTML for the initial form page
3.8 Deploying and testing the opening page
3.9 Mapping the logical name to a servlet class file
3.10 The first version of the controller servlet
3.11 Compiling, deploying, and testing the controller servlet
3.12 Building and testing the model class
3.13 Enhancing the servlet to call the model, so that we can get REAL advice...
3.14 Servlet version two code
3.15 Key steps for servlet version two
3.16 Review the partially completed, MVC beer advice web application
3.17 Create the JSP "view" that gives the advice
3.18 Enhancing the servlet to "call" the JSP (version three)
3.19 Code for servlet version three
3.20 Compile, deploy, and test the final app!
3.21 There is still so much to learn.
Chapter 4: Request and Response: Being a Servlet
4.1 Servlets are controlled by the Container
4.2 But there's more to a servlet's life
4.3 The Three Big Lifecycle Moments
4.4 Each request runs in a separate thread!
4.5 In the beginning: loading and initializing
4.6 The HTTP request Method determines whether doGet() or doPost() runs
4.7 Actually, one or more of the other HTTP Methods might make a (brief) appearance on the exam...
4.8 The difference between GET and POST
4.9 No, it's not just about the size
4.10 The story of the non-idempotent request
4.11 POST is not idempotent
4.12 What determines whether the browser sends a GET or POST request?
4.13 POST is NOT the default!
4.14 Sending and using a single parameter
4.15 Sending and using TWO parameters
4.16 Besides parameters, what else can I get from a Request object?
4.17 Review: servlet lifecycle and API
4.18 Review: HTTP and HttpServletRequest
4.19 So that's the Request... now let's see the Response
4.20 Using the response for I/O
4.21 Imagine you want to send a JAR to the client...
4.22 Servlet code to download the JAR
4.23 Whoa. What's the deal with content type?
4.24 You've got two choices for output: characters or bytes
4.25 You can set response headers, you can add response headers
4.26 But sometimes you just don't want to deal with the response yourself...
4.27 Servlet redirect makes the browser do the work
4.28 A request dispatch does the work on the server side
4.29 Redirect vs. Request Dispatch
4.30 Review: HttpServletResponse
4.31 Coffee Cram: Mock Exam Chapter 4
4.32 Coffee Cram: Chapter 4 Answers
Chapter 5: Attributes and Listeners: Being a Web App
5.1 Kim wants to configure his email address in the DD, not hard-code it inside the servlet class
5.2 Init Parameters to the rescue
5.3 You can't use servlet init parameters until the servlet is initialized
5.4 The servlet init parameters are read only ONCE-when the Container initializes the servlet
5.5 Testing your ServletConfig
5.6 How can a JSP get servlet init parameters?
5.7 Setting a request attribute works... but only for the JSP to which you forwarded the request
5.8 Context init parameters to the rescue
5.9 Remember the difference between servlet init parameters and context init parameters
5.10 ServletConfig is one per servlet ServletContext is one per web app
5.11 So what else can you do with your ServletContext?
5.12 What if you want an app init parameter that's a database DataSource?
5.13 What, exactly, is an attribute?
5.14 Coffee Cram: Mock Exam Chapter 5
5.15 Coffee Cram: Chapter 5 Answers
Chapter 6: Session Management: Conversational state
6.1 Kim wants to keep client-specific state across multiple requests
6.2 It's supposed to work like a REAL conversation...
6.3 How can he track the client's answers?
6.4 How sessions work
6.5 One problem... how does the Container know who the client is?
6.6 The client needs a unique session ID
6.7 How do the Client and Container exchange Session ID info?
6.8 The best part: the Container does virtually all the cookie work!
6.9 What if I want to know whether the session already existed or was just created?
6.10 What if I want ONLY a pre-existing session?
6.11 You can do sessions even if the client doesn't accept cookies, but you have to do a little more work...
6.12 Don't forget about HttpSessionBindingListener
6.13 HttpSessionActivationListener lets attributes prepare for the big move...
6.14 Session-related Listeners
6.15 Coffee Cram: Mock Exam Chapter 6
6.16 Coffee Cram: Chapter 6 Answers
Chapter 7: Using JSP: Being a JSP
7.1 In the end, a JSP is just a servlet
7.2 Making a JSP that displays how many times it's been accessed
7.3 She deploys and tests it
7.4 The JSP doesn't recognize the Counter class
7.5 Use the page directive to import packages
7.6 But then Kim mentions "expressions"
7.7 Expressions become the argument to an out.print()
7.8 Kim drops the final bombshell...
7.9 Declaring a variable in a scriptlet
7.10 What REALLY happens to your JSP code?
7.11 We need another JSP element...
7.12 JSP Declarations
7.13 Time to see the REAL generated servlet
7.14 The out variable isn't the only implicit object...
7.15 A comment...
7.16 API for the generated servlet
7.17 Lifecycle of a JSP
7.18 Translation and compilation happens only ONCE
7.19 Initializing your JSP
7.20 Attributes in a JSP
7.21 Using PageContext for attributes
7.22 Examples using pageContext to get and set attributes
7.23 While we're on the subject... let's talk more about the three directives
7.24 Scriptlets considered harmful?
7.25 There didn't used to BE an alternative.
7.26 EL: the answer to, well, everything.
7.27 Sneak peek at EL
7.28 Using
7.29 You can choose to ignore EL
7.30 But wait... there's still another JSP element we haven't seen: actions
7.31 Coffee Cram: Mock Exam Chapter 7
7.32 Coffee Cram: Chapter 7 Answers
Chapter 8: Scriptless JSP: Script-free pages
8.1 Our MVC app depends on attributes
8.2 But what if the attribute is not a String, but an instance of Person?
8.3 We need more code to get the Person's name
8.4 Person is a JavaBean, so we'll use the bean-related standard actions
8.5 Deconstructing and
8.6 can also CREATE a bean!
8.7 You can use
8.8 can have a body!
8.9 Generated servlet when has a body
8.10 Can you make polymorphic bean references?
8.11 Adding a type attribute to
8.12 Using type without class
8.13 The scope attribute defaults to "page"
8.14 Going straight from the request to the JSP without going through a servlet...
8.15 The param attribute to the rescue
8.16 But wait ! It gets even better...
8.17 If you can stand it, it gets even BETTER...
8.18 Bean tags convert primitive properties automatically
8.19 But what if the property is something OTHER than a String or primitive?
8.20 Trying to display the property of the property
8.21 Expression Language (EL) saves the day!
8.22 Deconstructing the JSP Expression Language (EL)
8.23 Using the dot (.) operator to access properties and map values
8.24 The [] operator is like the dot only way better
8.25 The [] gives you more options...
8.26 Using the [] operator with an array
8.27 A String index is coerced to an int for arrays and Lists
8.28 For beans and Maps you can use either operator
8.29 If it's NOT a String literal, it's evaluated
8.30 You can use nested expressions inside the brackets
8.31 You can't do ${foo.1}
8.32 EL renders raw text, including HTML
8.33 The EL implicit objects
8.34 Request parameters in EL
8.35 What if you want more information from the request?
8.36 The requestScope is NOT the request object
8.37 Scope implicit objects can save you
8.38 Getting Cookies and init params
8.39 Imagine you want your JSP to roll dice
8.40 Deploying an app with static functions
8.41 And a few other EL operators...
8.42 EL handles null values gracefully
8.43 JSP Expression Language (EL) review
8.44 Reusable template pieces
8.45 The include directive
8.46 The standard action
8.47 They're NOT the same underneath...
8.48 The include directive happens at translation time happens at runtime
8.49 The include directive at first request
8.50 The standard action at first request
8.51 Uh-oh. She's right...
8.52 The way we SHOULD have done it
8.53 Customizing the included content with
8.54 The standard action
8.55 A conditional forward...
8.56 How it runs...
8.57 With , the buffer is cleared BEFORE the forward
8.58 Bean-related standard action review
8.59 The include review
8.60 Coffee Cram: Mock Exam Chapter 8
8.61 Coffee Cram: Chapter 8 Answers
Chapter 9: Using JSTL: Custom tags are powerful
9.1 EL and standard actions are limited
9.2 The case of the disappearing HTML (reprised)
9.3 There's a better way: use the tag
9.4 Null values are rendered as blank text
9.5 Set a default value with the default attribute
9.6 Looping without scripting
9.7
9.8 Deconstructing
9.9 You can even nest tags
9.10 Doing a conditional include with
9.11 But what if you need an else?
9.12 The tag won't work for this
9.13 The tag and its partners and
9.14 The tag... so much cooler than
9.15 Using with beans and Maps
9.16 Key points and gotchas with
9.17 just makes sense
9.18 With , there are now THREE ways to include content
9.19 can reach OUTSIDE the web app
9.20 Customizing the thing you include
9.21 Doing the same thing with
9.22 for all your hyperlink needs
9.23 What if the URL needs encoding?
9.24 You do NOT want your clients to see this:
9.25 Make your own error pages
9.26 Configuring error pages in the DD
9.27 Error pages get an extra object: exception
9.28 The tag. Like try/catch...sort of
9.29 You can make the exception an attribute
9.30 What if you need a tag that's NOT in JSTL?
9.31 Using a tag library that's NOT from the JSTL
9.32 Making sense of the TLD
9.33 Using the custom "advice" tag
9.34 The custom tag handler
9.35 Pay attention to
9.36 is NOT just for EL expressions
9.37 What can be in a tag body
9.38 The tag handler, the TLD, and the JSP
9.39 The taglib is just a name, not a location
9.40 The Container builds a map
9.41 Four places the Container looks for TLDs
9.42 When a JSP uses more than one tag library
9.43 Coffee Cram: Mock Exam Chapter 9
9.44 Coffee Cram: Chapter 9 Answers
Chapter 10: Custom Tag Development: When even JSTL is not enough...
10.1 Includes and imports can be messy
10.2 Tag Files: like include, only better
10.3 But how do you send it parameters?
10.4 To a Tag File, you don't send request parameters, you send tag attributes!
10.5 Aren't tag attributes declared in the TLD?
10.6 Tag Files use the attribute directive
10.7 When an attribute value is really big
10.8 Declaring body-content for a Tag File
10.9 Where the Container looks for Tag Files
10.10 When you need more than Tag Files... Sometimes you need Java
10.11 Making a Simple tag handler
10.12 A Simple tag with a body
10.13 The Simple tag API
10.14 The life of a Simple tag handler
10.15 What if the tag body uses an expression?
10.16 A tag with dynamic row data: iterating the body
10.17 A Simple tag with an attribute
10.18 What exactly IS a JspFragment?
10.19 SkipPageException: stops processing the page...
10.20 SkipPageException shows everything up to the point of the exception
10.21 But what happens when the tag is invoked from an included page?
10.22 SkipPageException stops only the page that directly invoked the tag
10.23 You still have to know about Classic tag handlers
10.24 Tag handler API
10.25 A very small Classic tag handler
10.26 A Classic tag handler with TWO methods
10.27 When a tag has a body: comparing Simple vs. Classic
10.28 Classic tags have a different lifecycle
10.29 The Classic lifecycle depends on return values
10.30 IterationTag lets you repeat the body
10.31 Default return values from TagSupport
10.32 OK, let's get real...
10.33 Our dynamic tag isn't complete...
10.34 We could just add more custom tag attributes...
10.35 Son of more tag attributes
10.36 The return of the son of more tag attributes
10.37 I'm getting sick of these tag attributes!
10.38 Our tag handler code using the DynamicAttributes interface
10.39 The rest of the tag handler code
10.40 OK, there is a little bit of configuration in the TLD
10.41 What about Tag Files?
10.42 But what if you DO need access to the body contents?
10.43 With BodyTag, you get two new methods
10.44 With BodyTag, you can buffer the body
10.45 What if you have tags that work together?
10.46 A Tag can call its Parent Tag
10.47 Find out just how deep the nesting goes...
10.48 Simple tags can have Classic parents
10.49 You can walk up, but you can't walk down...
10.50 Getting info from child to parent
10.51 Menu and MenuItem tag handlers
10.52 Getting an arbitrary ancestor
10.53 Using the PageContext API for tag handlers
10.54 Coffee Cram: Mock Exam Chapter 10
10.55 Coffee Cram: Chapter 10 Answers
Chapter 11: Web App Deployment: Deploying your web app
11.1 The Joy of Deployment
11.2 What goes where in a web app
11.3 WAR files
11.4 What a deployed WAR file looks like
11.5 Making static content and JSPs directly accessible
11.6 How servlet mapping REALLY works
11.7 Servlet mappings can be "fake"
11.8 Subtle issues...
11.9 Configuring welcome files in the DD
11.10 How the Container chooses a welcome file
11.11 Configuring error pages in the DD
11.12 Configuring servlet initialization in the DD
11.13 Making an XML-compliant JSP: a JSP Document
11.14 Memorizing the EJB-related DD tags
11.15 Memorizing the JNDI DD tag
11.16 Memorizing the DD tag
11.17 Coffee Crem: Mock Exam Chapter 11
11.18 Coffee Crem: Chapter 11 Answers
Chapter 12: Web App Security: Keep it secret, keep it safe
12.1 The Bad Guys are everywhere
12.2 And it's not just the SERVER that gets hurt...
12.3 The Big 4 in servlet security
12.4 A little security story
12.5 How to Authenticate in HTTP World: the beginning of a secure transaction
12.6 A slightly closer look at how the Container does Authentication and Authorization
12.7 How did the Container do that ?
12.8 Keep security out of the code!
12.9 Who implements security in a web app?
12.10 The Big Jobs in servlet security
12.11 Just enough Authentication to discuss Authorization
12.12 Authorization Step 1: defining roles
12.13 Authorization Step 2: defining resource/method constraints
12.14 The rules for elements
12.15 Picky rules for sub-elements
12.16 The way works
12.17 How multiple elements interact
12.18 Dueling elements
12.19 Alice's recipe servlet, a story about programmatic security...
12.20 Customizing methods: isUserInRole()
12.21 The declarative side of programmatic security
12.22 Authentication revisited
12.23 Implementing Authentication
12.24 Form-Based Authentication
12.25 Summary of Authentication types
12.26 She doesn't know about J2EE's "protected transport layer connection"
12.27 Securing data in transit: HTTPS to the rescue
12.28 How to implement data confidentiality and integrity sparingly and declaratively
12.29 Protecting the request data
12.30 Coffee Cram: Mock Exam Chapter 12
12.31 Coffee Cram: Chapter 12 Answers
Chapter 13: Filters and Wrappers: The Power of Filters
13.1 Enhancing the entire web application
13.2 How about some kind of "filter"?
13.3 Filters are modular, and configurable in the DD
13.4 Three ways filters are like servlets
13.5 Building the request tracking filter
13.6 A filter's life cycle
13.7 Think of filters as being "stackable"
13.8 Declaring and ordering filters
13.9 News Flash: As of version 2.4, filters can be applied to request dispatchers
13.10 Compressing output with a response-side filter
13.11 Architecture of a response filter
13.12 But is it really that simple?
13.13 The output has left the building
13.14 We can implement our OWN response
13.15 Wrappers rock
13.16 Adding a simple Wrapper to the design
13.17 Add an output stream Wrapper
13.18 The real compression filter code
13.19 Compression wrapper code
13.20 Compression wrapper, helper class code
13.21 Coffee Cram: Mock Exam Chapter 13
13.22 Coffee Cram: Chapter 13 Answers
Chapter 14: Patterns and Struts: Enterprise Design Patterns
14.1 Web site hardware can get complicated
14.2 Web application software can get complicated
14.3 Lucky for us, we have J2EE patterns
14.4 Performance (and the "ilities")
14.5 Aligning our vernaculars...
14.6 More design principles...
14.7 Patterns to support remote model components
14.8 How the Business Team supports the web designers when the MVC components are running on one JVM
14.9 How will they handle remote objects?
14.10 RMI makes life easy
14.11 Just a little more RMI review
14.12 Adding RMI and JNDI to the controller
14.13 How about a "go-between" object?
14.14 The "go-between" is a Business Delegate
14.15 Simplify your Business Delegates with the Service Locator
14.16 Protecting the web designer's JSPs from remote model complexity
14.17 Compare the local model diagram to this remote model diagram
14.18 There's good news and bad news...
14.19 Time for a Transfer Object?
14.20 Business tier patterns: quick review
14.21 Our very first pattern revisited... MVC
14.22 MVC in a real web app
14.23 Looking at the MVC controller
14.24 Improving the MVC controllers
14.25 Designing our fantasy controller
14.26 Yes! It's Struts in a nutshell
14.27 Is Struts a container?
14.28 How does Front Controller fit in?
14.29 Refactoring the Beer app for Struts
14.30 The Struts Beer app architecture
14.31 A form bean exposed
14.32 How an Action object ticks
14.33 struts-config.xml: tying it all together
14.34 Specifying Struts in the web.xml DD
14.35 Install Struts, and Just Run It!
14.36 Creating the deployment environment
14.37 Patterns review for the SCWCD
14.38 Business Delegate
14.39 Service Locator
14.40 Transfer Object
14.41 Intercepting Filter
14.42 Model, View, Controller (MVC)
14.43 Front Controller
14.44 Coffee Cram: Mock Exam Chapter 14
14.45 Coffee Cram: Chapter 14 Answers
Final Mock Exam: Coffee Cram
Coffee Cram: Final Mock Exam
Coffee Cram: Final Exam Answers
Praise for the Head First approach
Perpetrators of the Head First series (and this book)
How to Use this Book: Intro
Who is this book for?
We know what you're thinking.
And we know what your brain is thinking
Metacognition: thinking about thinking
Here's what WE did
Here's what YOU can do to bend your brain into submission
What you need for this book
Last-minute things you need to know
About the SCWCD (for Java EE 1.5) exam
Beta testers & technical reviewers
Other people to : credit
Even more peopleThe large number of acknowledgments is because we're testing the theory that everyone mentioned in a book acknowledgment will buy at least one copy, probably more, what with relatives and everything. If you'd like to be in the acknowledgments of our next book, and you have a large family, write to us.
Chapter 1: Intro and Overview: Why use Servlets & JSPs?
1.1 Everybody wants a web site
1.2 What does your web server do?
1.3 What does a web client do?
1.4 Clients and servers know HTML and HTTP
1.5 Two-minute HTML guide
1.6 What you write... (the HTML)
1.7 What the browser creates...
1.8 What is the HTTP protocol?
1.9 HTML is part of the HTTP response
1.10 If that's the response, what's in the request?
1.11 GET is a simple request, POST can send user data
1.12 It's true... you can send a little data with HTTP GET
1.13 Anatomy of an HTTP GET request
1.14 Anatomy of an HTTP POST request
1.15 Anatomy of an HTTP response, and what the heck is a "MIME type"?
1.16 All the pieces. On one page.
1.17 URL. Whatever you do, don't pronounce it "Earl".
1.18 Directory structure for a simple Apache web site
1.19 Web servers love serving static web pages
1.20 But sometimes you need more than just the web server
1.21 Two things the web server alone won't do
1.22 The non-Java term for a web server helper app is "CGI" program
1.23 Servlets Demystified (write, deploy, run)
1.24 JSP is what happened when somebody introduced Java to HTML
Chapter 2: High-Level Overview: Web App Architecture
2.1 What is a Container?
2.2 What if you had Java, but no servlets or Containers?
2.3 What does the Container give you?
2.4 How the Container handles a request
2.5 How it looks in code (what makes a servlet a servlet)
2.6 You're wondering how the Container found the Servlet...
2.7 A servlet can have THREE names
2.8 Using the Deployment Descriptor to map URLs to servlets
2.9 But wait! There's more you can do with the DD
2.10 Story: Bob Builds a Matchmaking Site
2.11 He starts to build a bunch of servlets... one for each page
2.12 But then it gets ugly, so he adds JSPs
2.13 But then his friend says, "You ARE using MVC, right?"
2.14 The Model-View-Controller (MVC) Design Pattern fixes this
2.15 Applying the MVC pattern to the matchmaking web app
2.16 But then his friend Kim takes a look
2.17 Is there an answer?
2.18 A "working" Deployment Descriptor (DD)
2.19 How J2EE fits into all this
Chapter 3: Hands-on MVC: Mini MVC Tutorial
3.1 Let's build a real (small) web application
3.2 The User's View of the web application-a Beer Advisor
3.3 Here's the architecture...
3.4 Creating your development environment
3.5 Creating the deployment environment
3.6 Our roadmap for building the app
3.7 The HTML for the initial form page
3.8 Deploying and testing the opening page
3.9 Mapping the logical name to a servlet class file
3.10 The first version of the controller servlet
3.11 Compiling, deploying, and testing the controller servlet
3.12 Building and testing the model class
3.13 Enhancing the servlet to call the model, so that we can get REAL advice...
3.14 Servlet version two code
3.15 Key steps for servlet version two
3.16 Review the partially completed, MVC beer advice web application
3.17 Create the JSP "view" that gives the advice
3.18 Enhancing the servlet to "call" the JSP (version three)
3.19 Code for servlet version three
3.20 Compile, deploy, and test the final app!
3.21 There is still so much to learn.
Chapter 4: Request and Response: Being a Servlet
4.1 Servlets are controlled by the Container
4.2 But there's more to a servlet's life
4.3 The Three Big Lifecycle Moments
4.4 Each request runs in a separate thread!
4.5 In the beginning: loading and initializing
4.6 The HTTP request Method determines whether doGet() or doPost() runs
4.7 Actually, one or more of the other HTTP Methods might make a (brief) appearance on the exam...
4.8 The difference between GET and POST
4.9 No, it's not just about the size
4.10 The story of the non-idempotent request
4.11 POST is not idempotent
4.12 What determines whether the browser sends a GET or POST request?
4.13 POST is NOT the default!
4.14 Sending and using a single parameter
4.15 Sending and using TWO parameters
4.16 Besides parameters, what else can I get from a Request object?
4.17 Review: servlet lifecycle and API
4.18 Review: HTTP and HttpServletRequest
4.19 So that's the Request... now let's see the Response
4.20 Using the response for I/O
4.21 Imagine you want to send a JAR to the client...
4.22 Servlet code to download the JAR
4.23 Whoa. What's the deal with content type?
4.24 You've got two choices for output: characters or bytes
4.25 You can set response headers, you can add response headers
4.26 But sometimes you just don't want to deal with the response yourself...
4.27 Servlet redirect makes the browser do the work
4.28 A request dispatch does the work on the server side
4.29 Redirect vs. Request Dispatch
4.30 Review: HttpServletResponse
4.31 Coffee Cram: Mock Exam Chapter 4
4.32 Coffee Cram: Chapter 4 Answers
Chapter 5: Attributes and Listeners: Being a Web App
5.1 Kim wants to configure his email address in the DD, not hard-code it inside the servlet class
5.2 Init Parameters to the rescue
5.3 You can't use servlet init parameters until the servlet is initialized
5.4 The servlet init parameters are read only ONCE-when the Container initializes the servlet
5.5 Testing your ServletConfig
5.6 How can a JSP get servlet init parameters?
5.7 Setting a request attribute works... but only for the JSP to which you forwarded the request
5.8 Context init parameters to the rescue
5.9 Remember the difference between servlet init parameters and context init parameters
5.10 ServletConfig is one per servlet ServletContext is one per web app
5.11 So what else can you do with your ServletContext?
5.12 What if you want an app init parameter that's a database DataSource?
5.13 What, exactly, is an attribute?
5.14 Coffee Cram: Mock Exam Chapter 5
5.15 Coffee Cram: Chapter 5 Answers
Chapter 6: Session Management: Conversational state
6.1 Kim wants to keep client-specific state across multiple requests
6.2 It's supposed to work like a REAL conversation...
6.3 How can he track the client's answers?
6.4 How sessions work
6.5 One problem... how does the Container know who the client is?
6.6 The client needs a unique session ID
6.7 How do the Client and Container exchange Session ID info?
6.8 The best part: the Container does virtually all the cookie work!
6.9 What if I want to know whether the session already existed or was just created?
6.10 What if I want ONLY a pre-existing session?
6.11 You can do sessions even if the client doesn't accept cookies, but you have to do a little more work...
6.12 Don't forget about HttpSessionBindingListener
6.13 HttpSessionActivationListener lets attributes prepare for the big move...
6.14 Session-related Listeners
6.15 Coffee Cram: Mock Exam Chapter 6
6.16 Coffee Cram: Chapter 6 Answers
Chapter 7: Using JSP: Being a JSP
7.1 In the end, a JSP is just a servlet
7.2 Making a JSP that displays how many times it's been accessed
7.3 She deploys and tests it
7.4 The JSP doesn't recognize the Counter class
7.5 Use the page directive to import packages
7.6 But then Kim mentions "expressions"
7.7 Expressions become the argument to an out.print()
7.8 Kim drops the final bombshell...
7.9 Declaring a variable in a scriptlet
7.10 What REALLY happens to your JSP code?
7.11 We need another JSP element...
7.12 JSP Declarations
7.13 Time to see the REAL generated servlet
7.14 The out variable isn't the only implicit object...
7.15 A comment...
7.16 API for the generated servlet
7.17 Lifecycle of a JSP
7.18 Translation and compilation happens only ONCE
7.19 Initializing your JSP
7.20 Attributes in a JSP
7.21 Using PageContext for attributes
7.22 Examples using pageContext to get and set attributes
7.23 While we're on the subject... let's talk more about the three directives
7.24 Scriptlets considered harmful?
7.25 There didn't used to BE an alternative.
7.26 EL: the answer to, well, everything.
7.27 Sneak peek at EL
7.28 Using
7.29 You can choose to ignore EL
7.30 But wait... there's still another JSP element we haven't seen: actions
7.31 Coffee Cram: Mock Exam Chapter 7
7.32 Coffee Cram: Chapter 7 Answers
Chapter 8: Scriptless JSP: Script-free pages
8.1 Our MVC app depends on attributes
8.2 But what if the attribute is not a String, but an instance of Person?
8.3 We need more code to get the Person's name
8.4 Person is a JavaBean, so we'll use the bean-related standard actions
8.5 Deconstructing and
8.6 can also CREATE a bean!
8.7 You can use
8.8 can have a body!
8.9 Generated servlet when has a body
8.10 Can you make polymorphic bean references?
8.11 Adding a type attribute to
8.12 Using type without class
8.13 The scope attribute defaults to "page"
8.14 Going straight from the request to the JSP without going through a servlet...
8.15 The param attribute to the rescue
8.16 But wait ! It gets even better...
8.17 If you can stand it, it gets even BETTER...
8.18 Bean tags convert primitive properties automatically
8.19 But what if the property is something OTHER than a String or primitive?
8.20 Trying to display the property of the property
8.21 Expression Language (EL) saves the day!
8.22 Deconstructing the JSP Expression Language (EL)
8.23 Using the dot (.) operator to access properties and map values
8.24 The [] operator is like the dot only way better
8.25 The [] gives you more options...
8.26 Using the [] operator with an array
8.27 A String index is coerced to an int for arrays and Lists
8.28 For beans and Maps you can use either operator
8.29 If it's NOT a String literal, it's evaluated
8.30 You can use nested expressions inside the brackets
8.31 You can't do ${foo.1}
8.32 EL renders raw text, including HTML
8.33 The EL implicit objects
8.34 Request parameters in EL
8.35 What if you want more information from the request?
8.36 The requestScope is NOT the request object
8.37 Scope implicit objects can save you
8.38 Getting Cookies and init params
8.39 Imagine you want your JSP to roll dice
8.40 Deploying an app with static functions
8.41 And a few other EL operators...
8.42 EL handles null values gracefully
8.43 JSP Expression Language (EL) review
8.44 Reusable template pieces
8.45 The include directive
8.46 The standard action
8.47 They're NOT the same underneath...
8.48 The include directive happens at translation time happens at runtime
8.49 The include directive at first request
8.50 The standard action at first request
8.51 Uh-oh. She's right...
8.52 The way we SHOULD have done it
8.53 Customizing the included content with
8.54 The standard action
8.55 A conditional forward...
8.56 How it runs...
8.57 With , the buffer is cleared BEFORE the forward
8.58 Bean-related standard action review
8.59 The include review
8.60 Coffee Cram: Mock Exam Chapter 8
8.61 Coffee Cram: Chapter 8 Answers
Chapter 9: Using JSTL: Custom tags are powerful
9.1 EL and standard actions are limited
9.2 The case of the disappearing HTML (reprised)
9.3 There's a better way: use the tag
9.4 Null values are rendered as blank text
9.5 Set a default value with the default attribute
9.6 Looping without scripting
9.7
9.8 Deconstructing
9.9 You can even nest tags
9.10 Doing a conditional include with
9.11 But what if you need an else?
9.12 The tag won't work for this
9.13 The tag and its partners and
9.14 The tag... so much cooler than
9.15 Using with beans and Maps
9.16 Key points and gotchas with
9.17 just makes sense
9.18 With , there are now THREE ways to include content
9.19 can reach OUTSIDE the web app
9.20 Customizing the thing you include
9.21 Doing the same thing with
9.22 for all your hyperlink needs
9.23 What if the URL needs encoding?
9.24 You do NOT want your clients to see this:
9.25 Make your own error pages
9.26 Configuring error pages in the DD
9.27 Error pages get an extra object: exception
9.28 The tag. Like try/catch...sort of
9.29 You can make the exception an attribute
9.30 What if you need a tag that's NOT in JSTL?
9.31 Using a tag library that's NOT from the JSTL
9.32 Making sense of the TLD
9.33 Using the custom "advice" tag
9.34 The custom tag handler
9.35 Pay attention to
9.36 is NOT just for EL expressions
9.37 What can be in a tag body
9.38 The tag handler, the TLD, and the JSP
9.39 The taglib is just a name, not a location
9.40 The Container builds a map
9.41 Four places the Container looks for TLDs
9.42 When a JSP uses more than one tag library
9.43 Coffee Cram: Mock Exam Chapter 9
9.44 Coffee Cram: Chapter 9 Answers
Chapter 10: Custom Tag Development: When even JSTL is not enough...
10.1 Includes and imports can be messy
10.2 Tag Files: like include, only better
10.3 But how do you send it parameters?
10.4 To a Tag File, you don't send request parameters, you send tag attributes!
10.5 Aren't tag attributes declared in the TLD?
10.6 Tag Files use the attribute directive
10.7 When an attribute value is really big
10.8 Declaring body-content for a Tag File
10.9 Where the Container looks for Tag Files
10.10 When you need more than Tag Files... Sometimes you need Java
10.11 Making a Simple tag handler
10.12 A Simple tag with a body
10.13 The Simple tag API
10.14 The life of a Simple tag handler
10.15 What if the tag body uses an expression?
10.16 A tag with dynamic row data: iterating the body
10.17 A Simple tag with an attribute
10.18 What exactly IS a JspFragment?
10.19 SkipPageException: stops processing the page...
10.20 SkipPageException shows everything up to the point of the exception
10.21 But what happens when the tag is invoked from an included page?
10.22 SkipPageException stops only the page that directly invoked the tag
10.23 You still have to know about Classic tag handlers
10.24 Tag handler API
10.25 A very small Classic tag handler
10.26 A Classic tag handler with TWO methods
10.27 When a tag has a body: comparing Simple vs. Classic
10.28 Classic tags have a different lifecycle
10.29 The Classic lifecycle depends on return values
10.30 IterationTag lets you repeat the body
10.31 Default return values from TagSupport
10.32 OK, let's get real...
10.33 Our dynamic tag isn't complete...
10.34 We could just add more custom tag attributes...
10.35 Son of more tag attributes
10.36 The return of the son of more tag attributes
10.37 I'm getting sick of these tag attributes!
10.38 Our tag handler code using the DynamicAttributes interface
10.39 The rest of the tag handler code
10.40 OK, there is a little bit of configuration in the TLD
10.41 What about Tag Files?
10.42 But what if you DO need access to the body contents?
10.43 With BodyTag, you get two new methods
10.44 With BodyTag, you can buffer the body
10.45 What if you have tags that work together?
10.46 A Tag can call its Parent Tag
10.47 Find out just how deep the nesting goes...
10.48 Simple tags can have Classic parents
10.49 You can walk up, but you can't walk down...
10.50 Getting info from child to parent
10.51 Menu and MenuItem tag handlers
10.52 Getting an arbitrary ancestor
10.53 Using the PageContext API for tag handlers
10.54 Coffee Cram: Mock Exam Chapter 10
10.55 Coffee Cram: Chapter 10 Answers
Chapter 11: Web App Deployment: Deploying your web app
11.1 The Joy of Deployment
11.2 What goes where in a web app
11.3 WAR files
11.4 What a deployed WAR file looks like
11.5 Making static content and JSPs directly accessible
11.6 How servlet mapping REALLY works
11.7 Servlet mappings can be "fake"
11.8 Subtle issues...
11.9 Configuring welcome files in the DD
11.10 How the Container chooses a welcome file
11.11 Configuring error pages in the DD
11.12 Configuring servlet initialization in the DD
11.13 Making an XML-compliant JSP: a JSP Document
11.14 Memorizing the EJB-related DD tags
11.15 Memorizing the JNDI DD tag
11.16 Memorizing the DD tag
11.17 Coffee Crem: Mock Exam Chapter 11
11.18 Coffee Crem: Chapter 11 Answers
Chapter 12: Web App Security: Keep it secret, keep it safe
12.1 The Bad Guys are everywhere
12.2 And it's not just the SERVER that gets hurt...
12.3 The Big 4 in servlet security
12.4 A little security story
12.5 How to Authenticate in HTTP World: the beginning of a secure transaction
12.6 A slightly closer look at how the Container does Authentication and Authorization
12.7 How did the Container do that ?
12.8 Keep security out of the code!
12.9 Who implements security in a web app?
12.10 The Big Jobs in servlet security
12.11 Just enough Authentication to discuss Authorization
12.12 Authorization Step 1: defining roles
12.13 Authorization Step 2: defining resource/method constraints
12.14 The rules for elements
12.15 Picky rules for sub-elements
12.16 The way works
12.17 How multiple elements interact
12.18 Dueling elements
12.19 Alice's recipe servlet, a story about programmatic security...
12.20 Customizing methods: isUserInRole()
12.21 The declarative side of programmatic security
12.22 Authentication revisited
12.23 Implementing Authentication
12.24 Form-Based Authentication
12.25 Summary of Authentication types
12.26 She doesn't know about J2EE's "protected transport layer connection"
12.27 Securing data in transit: HTTPS to the rescue
12.28 How to implement data confidentiality and integrity sparingly and declaratively
12.29 Protecting the request data
12.30 Coffee Cram: Mock Exam Chapter 12
12.31 Coffee Cram: Chapter 12 Answers
Chapter 13: Filters and Wrappers: The Power of Filters
13.1 Enhancing the entire web application
13.2 How about some kind of "filter"?
13.3 Filters are modular, and configurable in the DD
13.4 Three ways filters are like servlets
13.5 Building the request tracking filter
13.6 A filter's life cycle
13.7 Think of filters as being "stackable"
13.8 Declaring and ordering filters
13.9 News Flash: As of version 2.4, filters can be applied to request dispatchers
13.10 Compressing output with a response-side filter
13.11 Architecture of a response filter
13.12 But is it really that simple?
13.13 The output has left the building
13.14 We can implement our OWN response
13.15 Wrappers rock
13.16 Adding a simple Wrapper to the design
13.17 Add an output stream Wrapper
13.18 The real compression filter code
13.19 Compression wrapper code
13.20 Compression wrapper, helper class code
13.21 Coffee Cram: Mock Exam Chapter 13
13.22 Coffee Cram: Chapter 13 Answers
Chapter 14: Patterns and Struts: Enterprise Design Patterns
14.1 Web site hardware can get complicated
14.2 Web application software can get complicated
14.3 Lucky for us, we have J2EE patterns
14.4 Performance (and the "ilities")
14.5 Aligning our vernaculars...
14.6 More design principles...
14.7 Patterns to support remote model components
14.8 How the Business Team supports the web designers when the MVC components are running on one JVM
14.9 How will they handle remote objects?
14.10 RMI makes life easy
14.11 Just a little more RMI review
14.12 Adding RMI and JNDI to the controller
14.13 How about a "go-between" object?
14.14 The "go-between" is a Business Delegate
14.15 Simplify your Business Delegates with the Service Locator
14.16 Protecting the web designer's JSPs from remote model complexity
14.17 Compare the local model diagram to this remote model diagram
14.18 There's good news and bad news...
14.19 Time for a Transfer Object?
14.20 Business tier patterns: quick review
14.21 Our very first pattern revisited... MVC
14.22 MVC in a real web app
14.23 Looking at the MVC controller
14.24 Improving the MVC controllers
14.25 Designing our fantasy controller
14.26 Yes! It's Struts in a nutshell
14.27 Is Struts a container?
14.28 How does Front Controller fit in?
14.29 Refactoring the Beer app for Struts
14.30 The Struts Beer app architecture
14.31 A form bean exposed
14.32 How an Action object ticks
14.33 struts-config.xml: tying it all together
14.34 Specifying Struts in the web.xml DD
14.35 Install Struts, and Just Run It!
14.36 Creating the deployment environment
14.37 Patterns review for the SCWCD
14.38 Business Delegate
14.39 Service Locator
14.40 Transfer Object
14.41 Intercepting Filter
14.42 Model, View, Controller (MVC)
14.43 Front Controller
14.44 Coffee Cram: Mock Exam Chapter 14
14.45 Coffee Cram: Chapter 14 Answers
Final Mock Exam: Coffee Cram
Coffee Cram: Final Mock Exam
Coffee Cram: Final Exam Answers
Praise for Head First Servlets and JSP(TM)
Praise for the Head First approach
Perpetrators of the Head First series (and this book)
How to Use this Book: Intro
Who is this book for?
We know what you're thinking.
And we know what your brain is thinking
Metacognition: thinking about thinking
Here's what WE did
Here's what YOU can do to bend your brain into submission
What you need for this book
Last-minute things you need to know
About the SCWCD (for Java EE 1.5) exam
Beta testers & technical reviewers
Other people to : credit
Even more peopleThe large number of acknowledgments is because we're testing the theory that everyone mentioned in a book acknowledgment will buy at least one copy, probably more, what with relatives and everything. If you'd like to be in the acknowledgments of our next book, and you have a large family, write to us.
Chapter 1: Intro and Overview: Why use Servlets & JSPs?
1.1 Everybody wants a web site
1.2 What does your web server do?
1.3 What does a web client do?
1.4 Clients and servers know HTML and HTTP
1.5 Two-minute HTML guide
1.6 What you write... (the HTML)
1.7 What the browser creates...
1.8 What is the HTTP protocol?
1.9 HTML is part of the HTTP response
1.10 If that's the response, what's in the request?
1.11 GET is a simple request, POST can send user data
1.12 It's true... you can send a little data with HTTP GET
1.13 Anatomy of an HTTP GET request
1.14 Anatomy of an HTTP POST request
1.15 Anatomy of an HTTP response, and what the heck is a "MIME type"?
1.16 All the pieces. On one page.
1.17 URL. Whatever you do, don't pronounce it "Earl".
1.18 Directory structure for a simple Apache web site
1.19 Web servers love serving static web pages
1.20 But sometimes you need more than just the web server
1.21 Two things the web server alone won't do
1.22 The non-Java term for a web server helper app is "CGI" program
1.23 Servlets Demystified (write, deploy, run)
1.24 JSP is what happened when somebody introduced Java to HTML
Chapter 2: High-Level Overview: Web App Architecture
2.1 What is a Container?
2.2 What if you had Java, but no servlets or Containers?
2.3 What does the Container give you?
2.4 How the Container handles a request
2.5 How it looks in code (what makes a servlet a servlet)
2.6 You're wondering how the Container found the Servlet...
2.7 A servlet can have THREE names
2.8 Using the Deployment Descriptor to map URLs to servlets
2.9 But wait! There's more you can do with the DD
2.10 Story: Bob Builds a Matchmaking Site
2.11 He starts to build a bunch of servlets... one for each page
2.12 But then it gets ugly, so he adds JSPs
2.13 But then his friend says, "You ARE using MVC, right?"
2.14 The Model-View-Controller (MVC) Design Pattern fixes this
2.15 Applying the MVC pattern to the matchmaking web app
2.16 But then his friend Kim takes a look
2.17 Is there an answer?
2.18 A "working" Deployment Descriptor (DD)
2.19 How J2EE fits into all this
Chapter 3: Hands-on MVC: Mini MVC Tutorial
3.1 Let's build a real (small) web application
3.2 The User's View of the web application-a Beer Advisor
3.3 Here's the architecture...
3.4 Creating your development environment
3.5 Creating the deployment environment
3.6 Our roadmap for building the app
3.7 The HTML for the initial form page
3.8 Deploying and testing the opening page
3.9 Mapping the logical name to a servlet class file
3.10 The first version of the controller servlet
3.11 Compiling, deploying, and testing the controller servlet
3.12 Building and testing the model class
3.13 Enhancing the servlet to call the model, so that we can get REAL advice...
3.14 Servlet version two code
3.15 Key steps for servlet version two
3.16 Review the partially completed, MVC beer advice web application
3.17 Create the JSP "view" that gives the advice
3.18 Enhancing the servlet to "call" the JSP (version three)
3.19 Code for servlet version three
3.20 Compile, deploy, and test the final app!
3.21 There is still so much to learn.
Chapter 4: Request and Response: Being a Servlet
4.1 Servlets are controlled by the Container
4.2 But there's more to a servlet's life
4.3 The Three Big Lifecycle Moments
4.4 Each request runs in a separate thread!
4.5 In the beginning: loading and initializing
4.6 The HTTP request Method determines whether doGet() or doPost() runs
4.7 Actually, one or more of the other HTTP Methods might make a (brief) appearance on the exam...
4.8 The difference between GET and POST
4.9 No, it's not just about the size
4.10 The story of the non-idempotent request
4.11 POST is not idempotent
4.12 What determines whether the browser sends a GET or POST request?
4.13 POST is NOT the default!
4.14 Sending and using a single parameter
4.15 Sending and using TWO parameters
4.16 Besides parameters, what else can I get from a Request object?
4.17 Review: servlet lifecycle and API
4.18 Review: HTTP and HttpServletRequest
4.19 So that's the Request... now let's see the Response
4.20 Using the response for I/O
4.21 Imagine you want to send a JAR to the client...
4.22 Servlet code to download the JAR
4.23 Whoa. What's the deal with content type?
4.24 You've got two choices for output: characters or bytes
4.25 You can set response headers, you can add response headers
4.26 But sometimes you just don't want to deal with the response yourself...
4.27 Servlet redirect makes the browser do the work
4.28 A request dispatch does the work on the server side
4.29 Redirect vs. Request Dispatch
4.30 Review: HttpServletResponse
4.31 Coffee Cram: Mock Exam Chapter 4
4.32 Coffee Cram: Chapter 4 Answers
Chapter 5: Attributes and Listeners: Being a Web App
5.1 Kim wants to configure his email address in the DD, not hard-code it inside the servlet class
5.2 Init Parameters to the rescue
5.3 You can't use servlet init parameters until the servlet is initialized
5.4 The servlet init parameters are read only ONCE-when the Container initializes the servlet
5.5 Testing your ServletConfig
5.6 How can a JSP get servlet init parameters?
5.7 Setting a request attribute works... but only for the JSP to which you forwarded the request
5.8 Context init parameters to the rescue
5.9 Remember the difference between servlet init parameters and context init parameters
5.10 ServletConfig is one per servlet ServletContext is one per web app
5.11 So what else can you do with your ServletContext?
5.12 What if you want an app init parameter that's a database DataSource?
5.13 What, exactly, is an attribute?
5.14 Coffee Cram: Mock Exam Chapter 5
5.15 Coffee Cram: Chapter 5 Answers
Chapter 6: Session Management: Conversational state
6.1 Kim wants to keep client-specific state across multiple requests
6.2 It's supposed to work like a REAL conversation...
6.3 How can he track the client's answers?
6.4 How sessions work
6.5 One problem... how does the Container know who the client is?
6.6 The client needs a unique session ID
6.7 How do the Client and Container exchange Session ID info?
6.8 The best part: the Container does virtually all the cookie work!
6.9 What if I want to know whether the session already existed or was just created?
6.10 What if I want ONLY a pre-existing session?
6.11 You can do sessions even if the client doesn't accept cookies, but you have to do a little more work...
6.12 Don't forget about HttpSessionBindingListener
6.13 HttpSessionActivationListener lets attributes prepare for the big move...
6.14 Session-related Listeners
6.15 Coffee Cram: Mock Exam Chapter 6
6.16 Coffee Cram: Chapter 6 Answers
Chapter 7: Using JSP: Being a JSP
7.1 In the end, a JSP is just a servlet
7.2 Making a JSP that displays how many times it's been accessed
7.3 She deploys and tests it
7.4 The JSP doesn't recognize the Counter class
7.5 Use the page directive to import packages
7.6 But then Kim mentions "expressions"
7.7 Expressions become the argument to an out.print()
7.8 Kim drops the final bombshell...
7.9 Declaring a variable in a scriptlet
7.10 What REALLY happens to your JSP code?
7.11 We need another JSP element...
7.12 JSP Declarations
7.13 Time to see the REAL generated servlet
7.14 The out variable isn't the only implicit object...
7.15 A comment...
7.16 API for the generated servlet
7.17 Lifecycle of a JSP
7.18 Translation and compilation happens only ONCE
7.19 Initializing your JSP
7.20 Attributes in a JSP
7.21 Using PageContext for attributes
7.22 Examples using pageContext to get and set attributes
7.23 While we're on the subject... let's talk more about the three directives
7.24 Scriptlets considered harmful?
7.25 There didn't used to BE an alternative.
7.26 EL: the answer to, well, everything.
7.27 Sneak peek at EL
7.28 Using
7.29 You can choose to ignore EL
7.30 But wait... there's still another JSP element we haven't seen: actions
7.31 Coffee Cram: Mock Exam Chapter 7
7.32 Coffee Cram: Chapter 7 Answers
Chapter 8: Scriptless JSP: Script-free pages
8.1 Our MVC app depends on attributes
8.2 But what if the attribute is not a String, but an instance of Person?
8.3 We need more code to get the Person's name
8.4 Person is a JavaBean, so we'll use the bean-related standard actions
8.5 Deconstructing and
8.6 can also CREATE a bean!
8.7 You can use
8.8 can have a body!
8.9 Generated servlet when has a body
8.10 Can you make polymorphic bean references?
8.11 Adding a type attribute to
8.12 Using type without class
8.13 The scope attribute defaults to "page"
8.14 Going straight from the request to the JSP without going through a servlet...
8.15 The param attribute to the rescue
8.16 But wait ! It gets even better...
8.17 If you can stand it, it gets even BETTER...
8.18 Bean tags convert primitive properties automatically
8.19 But what if the property is something OTHER than a String or primitive?
8.20 Trying to display the property of the property
8.21 Expression Language (EL) saves the day!
8.22 Deconstructing the JSP Expression Language (EL)
8.23 Using the dot (.) operator to access properties and map values
8.24 The [] operator is like the dot only way better
8.25 The [] gives you more options...
8.26 Using the [] operator with an array
8.27 A String index is coerced to an int for arrays and Lists
8.28 For beans and Maps you can use either operator
8.29 If it's NOT a String literal, it's evaluated
8.30 You can use nested expressions inside the brackets
8.31 You can't do ${foo.1}
8.32 EL renders raw text, including HTML
8.33 The EL implicit objects
8.34 Request parameters in EL
8.35 What if you want more information from the request?
8.36 The requestScope is NOT the request object
8.37 Scope implicit objects can save you
8.38 Getting Cookies and init params
8.39 Imagine you want your JSP to roll dice
8.40 Deploying an app with static functions
8.41 And a few other EL operators...
8.42 EL handles null values gracefully
8.43 JSP Expression Language (EL) review
8.44 Reusable template pieces
8.45 The include directive
8.46 The standard action
8.47 They're NOT the same underneath...
8.48 The include directive happens at translation time happens at runtime
8.49 The include directive at first request
8.50 The standard action at first request
8.51 Uh-oh. She's right...
8.52 The way we SHOULD have done it
8.53 Customizing the included content with
8.54 The standard action
8.55 A conditional forward...
8.56 How it runs...
8.57 With , the buffer is cleared BEFORE the forward
8.58 Bean-related standard action review
8.59 The include review
8.60 Coffee Cram: Mock Exam Chapter 8
8.61 Coffee Cram: Chapter 8 Answers
Chapter 9: Using JSTL: Custom tags are powerful
9.1 EL and standard actions are limited
9.2 The case of the disappearing HTML (reprised)
9.3 There's a better way: use the tag
9.4 Null values are rendered as blank text
9.5 Set a default value with the default attribute
9.6 Looping without scripting
9.7
9.8 Deconstructing
9.9 You can even nest tags
9.10 Doing a conditional include with
9.11 But what if you need an else?
9.12 The tag won't work for this
9.13 The tag and its partners and
9.14 The tag... so much cooler than
9.15 Using with beans and Maps
9.16 Key points and gotchas with
9.17 just makes sense
9.18 With , there are now THREE ways to include content
9.19 can reach OUTSIDE the web app
9.20 Customizing the thing you include
9.21 Doing the same thing with
9.22 for all your hyperlink needs
9.23 What if the URL needs encoding?
9.24 You do NOT want your clients to see this:
9.25 Make your own error pages
9.26 Configuring error pages in the DD
9.27 Error pages get an extra object: exception
9.28 The tag. Like try/catch...sort of
9.29 You can make the exception an attribute
9.30 What if you need a tag that's NOT in JSTL?
9.31 Using a tag library that's NOT from the JSTL
9.32 Making sense of the TLD
9.33 Using the custom "advice" tag
9.34 The custom tag handler
9.35 Pay attention to
9.36 is NOT just for EL expressions
9.37 What can be in a tag body
9.38 The tag handler, the TLD, and the JSP
9.39 The taglib is just a name, not a location
9.40 The Container builds a map
9.41 Four places the Container looks for TLDs
9.42 When a JSP uses more than one tag library
9.43 Coffee Cram: Mock Exam Chapter 9
9.44 Coffee Cram: Chapter 9 Answers
Chapter 10: Custom Tag Development: When even JSTL is not enough...
10.1 Includes and imports can be messy
10.2 Tag Files: like include, only better
10.3 But how do you send it parameters?
10.4 To a Tag File, you don't send request parameters, you send tag attributes!
10.5 Aren't tag attributes declared in the TLD?
10.6 Tag Files use the attribute directive
10.7 When an attribute value is really big
10.8 Declaring body-content for a Tag File
10.9 Where the Container looks for Tag Files
10.10 When you need more than Tag Files... Sometimes you need Java
10.11 Making a Simple tag handler
10.12 A Simple tag with a body
10.13 The Simple tag API
10.14 The life of a Simple tag handler
10.15 What if the tag body uses an expression?
10.16 A tag with dynamic row data: iterating the body
10.17 A Simple tag with an attribute
10.18 What exactly IS a JspFragment?
10.19 SkipPageException: stops processing the page...
10.20 SkipPageException shows everything up to the point of the exception
10.21 But what happens when the tag is invoked from an included page?
10.22 SkipPageException stops only the page that directly invoked the tag
10.23 You still have to know about Classic tag handlers
10.24 Tag handler API
10.25 A very small Classic tag handler
10.26 A Classic tag handler with TWO methods
10.27 When a tag has a body: comparing Simple vs. Classic
10.28 Classic tags have a different lifecycle
10.29 The Classic lifecycle depends on return values
10.30 IterationTag lets you repeat the body
10.31 Default return values from TagSupport
10.32 OK, let's get real...
10.33 Our dynamic tag isn't complete...
10.34 We could just add more custom tag attributes...
10.35 Son of more tag attributes
10.36 The return of the son of more tag attributes
10.37 I'm getting sick of these tag attributes!
10.38 Our tag handler code using the DynamicAttributes interface
10.39 The rest of the tag handler code
10.40 OK, there is a little bit of configuration in the TLD
10.41 What about Tag Files?
10.42 But what if you DO need access to the body contents?
10.43 With BodyTag, you get two new methods
10.44 With BodyTag, you can buffer the body
10.45 What if you have tags that work together?
10.46 A Tag can call its Parent Tag
10.47 Find out just how deep the nesting goes...
10.48 Simple tags can have Classic parents
10.49 You can walk up, but you can't walk down...
10.50 Getting info from child to parent
10.51 Menu and MenuItem tag handlers
10.52 Getting an arbitrary ancestor
10.53 Using the PageContext API for tag handlers
10.54 Coffee Cram: Mock Exam Chapter 10
10.55 Coffee Cram: Chapter 10 Answers
Chapter 11: Web App Deployment: Deploying your web app
11.1 The Joy of Deployment
11.2 What goes where in a web app
11.3 WAR files
11.4 What a deployed WAR file looks like
11.5 Making static content and JSPs directly accessible
11.6 How servlet mapping REALLY works
11.7 Servlet mappings can be "fake"
11.8 Subtle issues...
11.9 Configuring welcome files in the DD
11.10 How the Container chooses a welcome file
11.11 Configuring error pages in the DD
11.12 Configuring servlet initialization in the DD
11.13 Making an XML-compliant JSP: a JSP Document
11.14 Memorizing the EJB-related DD tags
11.15 Memorizing the JNDI DD tag
11.16 Memorizing the DD tag
11.17 Coffee Crem: Mock Exam Chapter 11
11.18 Coffee Crem: Chapter 11 Answers
Chapter 12: Web App Security: Keep it secret, keep it safe
12.1 The Bad Guys are everywhere
12.2 And it's not just the SERVER that gets hurt...
12.3 The Big 4 in servlet security
12.4 A little security story
12.5 How to Authenticate in HTTP World: the beginning of a secure transaction
12.6 A slightly closer look at how the Container does Authentication and Authorization
12.7 How did the Container do that ?
12.8 Keep security out of the code!
12.9 Who implements security in a web app?
12.10 The Big Jobs in servlet security
12.11 Just enough Authentication to discuss Authorization
12.12 Authorization Step 1: defining roles
12.13 Authorization Step 2: defining resource/method constraints
12.14 The rules for elements
12.15 Picky rules for sub-elements
12.16 The way works
12.17 How multiple elements interact
12.18 Dueling elements
12.19 Alice's recipe servlet, a story about programmatic security...
12.20 Customizing methods: isUserInRole()
12.21 The declarative side of programmatic security
12.22 Authentication revisited
12.23 Implementing Authentication
12.24 Form-Based Authentication
12.25 Summary of Authentication types
12.26 She doesn't know about J2EE's "protected transport layer connection"
12.27 Securing data in transit: HTTPS to the rescue
12.28 How to implement data confidentiality and integrity sparingly and declaratively
12.29 Protecting the request data
12.30 Coffee Cram: Mock Exam Chapter 12
12.31 Coffee Cram: Chapter 12 Answers
Chapter 13: Filters and Wrappers: The Power of Filters
13.1 Enhancing the entire web application
13.2 How about some kind of "filter"?
13.3 Filters are modular, and configurable in the DD
13.4 Three ways filters are like servlets
13.5 Building the request tracking filter
13.6 A filter's life cycle
13.7 Think of filters as being "stackable"
13.8 Declaring and ordering filters
13.9 News Flash: As of version 2.4, filters can be applied to request dispatchers
13.10 Compressing output with a response-side filter
13.11 Architecture of a response filter
13.12 But is it really that simple?
13.13 The output has left the building
13.14 We can implement our OWN response
13.15 Wrappers rock
13.16 Adding a simple Wrapper to the design
13.17 Add an output stream Wrapper
13.18 The real compression filter code
13.19 Compression wrapper code
13.20 Compression wrapper, helper class code
13.21 Coffee Cram: Mock Exam Chapter 13
13.22 Coffee Cram: Chapter 13 Answers
Chapter 14: Patterns and Struts: Enterprise Design Patterns
14.1 Web site hardware can get complicated
14.2 Web application software can get complicated
14.3 Lucky for us, we have J2EE patterns
14.4 Performance (and the "ilities")
14.5 Aligning our vernaculars...
14.6 More design principles...
14.7 Patterns to support remote model components
14.8 How the Business Team supports the web designers when the MVC components are running on one JVM
14.9 How will they handle remote objects?
14.10 RMI makes life easy
14.11 Just a little more RMI review
14.12 Adding RMI and JNDI to the controller
14.13 How about a "go-between" object?
14.14 The "go-between" is a Business Delegate
14.15 Simplify your Business Delegates with the Service Locator
14.16 Protecting the web designer's JSPs from remote model complexity
14.17 Compare the local model diagram to this remote model diagram
14.18 There's good news and bad news...
14.19 Time for a Transfer Object?
14.20 Business tier patterns: quick review
14.21 Our very first pattern revisited... MVC
14.22 MVC in a real web app
14.23 Looking at the MVC controller
14.24 Improving the MVC controllers
14.25 Designing our fantasy controller
14.26 Yes! It's Struts in a nutshell
14.27 Is Struts a container?
14.28 How does Front Controller fit in?
14.29 Refactoring the Beer app for Struts
14.30 The Struts Beer app architecture
14.31 A form bean exposed
14.32 How an Action object ticks
14.33 struts-config.xml: tying it all together
14.34 Specifying Struts in the web.xml DD
14.35 Install Struts, and Just Run It!
14.36 Creating the deployment environment
14.37 Patterns review for the SCWCD
14.38 Business Delegate
14.39 Service Locator
14.40 Transfer Object
14.41 Intercepting Filter
14.42 Model, View, Controller (MVC)
14.43 Front Controller
14.44 Coffee Cram: Mock Exam Chapter 14
14.45 Coffee Cram: Chapter 14 Answers
Final Mock Exam: Coffee Cram
Coffee Cram: Final Mock Exam
Coffee Cram: Final Exam Answers
Praise for the Head First approach
Perpetrators of the Head First series (and this book)
How to Use this Book: Intro
Who is this book for?
We know what you're thinking.
And we know what your brain is thinking
Metacognition: thinking about thinking
Here's what WE did
Here's what YOU can do to bend your brain into submission
What you need for this book
Last-minute things you need to know
About the SCWCD (for Java EE 1.5) exam
Beta testers & technical reviewers
Other people to : credit
Even more peopleThe large number of acknowledgments is because we're testing the theory that everyone mentioned in a book acknowledgment will buy at least one copy, probably more, what with relatives and everything. If you'd like to be in the acknowledgments of our next book, and you have a large family, write to us.
Chapter 1: Intro and Overview: Why use Servlets & JSPs?
1.1 Everybody wants a web site
1.2 What does your web server do?
1.3 What does a web client do?
1.4 Clients and servers know HTML and HTTP
1.5 Two-minute HTML guide
1.6 What you write... (the HTML)
1.7 What the browser creates...
1.8 What is the HTTP protocol?
1.9 HTML is part of the HTTP response
1.10 If that's the response, what's in the request?
1.11 GET is a simple request, POST can send user data
1.12 It's true... you can send a little data with HTTP GET
1.13 Anatomy of an HTTP GET request
1.14 Anatomy of an HTTP POST request
1.15 Anatomy of an HTTP response, and what the heck is a "MIME type"?
1.16 All the pieces. On one page.
1.17 URL. Whatever you do, don't pronounce it "Earl".
1.18 Directory structure for a simple Apache web site
1.19 Web servers love serving static web pages
1.20 But sometimes you need more than just the web server
1.21 Two things the web server alone won't do
1.22 The non-Java term for a web server helper app is "CGI" program
1.23 Servlets Demystified (write, deploy, run)
1.24 JSP is what happened when somebody introduced Java to HTML
Chapter 2: High-Level Overview: Web App Architecture
2.1 What is a Container?
2.2 What if you had Java, but no servlets or Containers?
2.3 What does the Container give you?
2.4 How the Container handles a request
2.5 How it looks in code (what makes a servlet a servlet)
2.6 You're wondering how the Container found the Servlet...
2.7 A servlet can have THREE names
2.8 Using the Deployment Descriptor to map URLs to servlets
2.9 But wait! There's more you can do with the DD
2.10 Story: Bob Builds a Matchmaking Site
2.11 He starts to build a bunch of servlets... one for each page
2.12 But then it gets ugly, so he adds JSPs
2.13 But then his friend says, "You ARE using MVC, right?"
2.14 The Model-View-Controller (MVC) Design Pattern fixes this
2.15 Applying the MVC pattern to the matchmaking web app
2.16 But then his friend Kim takes a look
2.17 Is there an answer?
2.18 A "working" Deployment Descriptor (DD)
2.19 How J2EE fits into all this
Chapter 3: Hands-on MVC: Mini MVC Tutorial
3.1 Let's build a real (small) web application
3.2 The User's View of the web application-a Beer Advisor
3.3 Here's the architecture...
3.4 Creating your development environment
3.5 Creating the deployment environment
3.6 Our roadmap for building the app
3.7 The HTML for the initial form page
3.8 Deploying and testing the opening page
3.9 Mapping the logical name to a servlet class file
3.10 The first version of the controller servlet
3.11 Compiling, deploying, and testing the controller servlet
3.12 Building and testing the model class
3.13 Enhancing the servlet to call the model, so that we can get REAL advice...
3.14 Servlet version two code
3.15 Key steps for servlet version two
3.16 Review the partially completed, MVC beer advice web application
3.17 Create the JSP "view" that gives the advice
3.18 Enhancing the servlet to "call" the JSP (version three)
3.19 Code for servlet version three
3.20 Compile, deploy, and test the final app!
3.21 There is still so much to learn.
Chapter 4: Request and Response: Being a Servlet
4.1 Servlets are controlled by the Container
4.2 But there's more to a servlet's life
4.3 The Three Big Lifecycle Moments
4.4 Each request runs in a separate thread!
4.5 In the beginning: loading and initializing
4.6 The HTTP request Method determines whether doGet() or doPost() runs
4.7 Actually, one or more of the other HTTP Methods might make a (brief) appearance on the exam...
4.8 The difference between GET and POST
4.9 No, it's not just about the size
4.10 The story of the non-idempotent request
4.11 POST is not idempotent
4.12 What determines whether the browser sends a GET or POST request?
4.13 POST is NOT the default!
4.14 Sending and using a single parameter
4.15 Sending and using TWO parameters
4.16 Besides parameters, what else can I get from a Request object?
4.17 Review: servlet lifecycle and API
4.18 Review: HTTP and HttpServletRequest
4.19 So that's the Request... now let's see the Response
4.20 Using the response for I/O
4.21 Imagine you want to send a JAR to the client...
4.22 Servlet code to download the JAR
4.23 Whoa. What's the deal with content type?
4.24 You've got two choices for output: characters or bytes
4.25 You can set response headers, you can add response headers
4.26 But sometimes you just don't want to deal with the response yourself...
4.27 Servlet redirect makes the browser do the work
4.28 A request dispatch does the work on the server side
4.29 Redirect vs. Request Dispatch
4.30 Review: HttpServletResponse
4.31 Coffee Cram: Mock Exam Chapter 4
4.32 Coffee Cram: Chapter 4 Answers
Chapter 5: Attributes and Listeners: Being a Web App
5.1 Kim wants to configure his email address in the DD, not hard-code it inside the servlet class
5.2 Init Parameters to the rescue
5.3 You can't use servlet init parameters until the servlet is initialized
5.4 The servlet init parameters are read only ONCE-when the Container initializes the servlet
5.5 Testing your ServletConfig
5.6 How can a JSP get servlet init parameters?
5.7 Setting a request attribute works... but only for the JSP to which you forwarded the request
5.8 Context init parameters to the rescue
5.9 Remember the difference between servlet init parameters and context init parameters
5.10 ServletConfig is one per servlet ServletContext is one per web app
5.11 So what else can you do with your ServletContext?
5.12 What if you want an app init parameter that's a database DataSource?
5.13 What, exactly, is an attribute?
5.14 Coffee Cram: Mock Exam Chapter 5
5.15 Coffee Cram: Chapter 5 Answers
Chapter 6: Session Management: Conversational state
6.1 Kim wants to keep client-specific state across multiple requests
6.2 It's supposed to work like a REAL conversation...
6.3 How can he track the client's answers?
6.4 How sessions work
6.5 One problem... how does the Container know who the client is?
6.6 The client needs a unique session ID
6.7 How do the Client and Container exchange Session ID info?
6.8 The best part: the Container does virtually all the cookie work!
6.9 What if I want to know whether the session already existed or was just created?
6.10 What if I want ONLY a pre-existing session?
6.11 You can do sessions even if the client doesn't accept cookies, but you have to do a little more work...
6.12 Don't forget about HttpSessionBindingListener
6.13 HttpSessionActivationListener lets attributes prepare for the big move...
6.14 Session-related Listeners
6.15 Coffee Cram: Mock Exam Chapter 6
6.16 Coffee Cram: Chapter 6 Answers
Chapter 7: Using JSP: Being a JSP
7.1 In the end, a JSP is just a servlet
7.2 Making a JSP that displays how many times it's been accessed
7.3 She deploys and tests it
7.4 The JSP doesn't recognize the Counter class
7.5 Use the page directive to import packages
7.6 But then Kim mentions "expressions"
7.7 Expressions become the argument to an out.print()
7.8 Kim drops the final bombshell...
7.9 Declaring a variable in a scriptlet
7.10 What REALLY happens to your JSP code?
7.11 We need another JSP element...
7.12 JSP Declarations
7.13 Time to see the REAL generated servlet
7.14 The out variable isn't the only implicit object...
7.15 A comment...
7.16 API for the generated servlet
7.17 Lifecycle of a JSP
7.18 Translation and compilation happens only ONCE
7.19 Initializing your JSP
7.20 Attributes in a JSP
7.21 Using PageContext for attributes
7.22 Examples using pageContext to get and set attributes
7.23 While we're on the subject... let's talk more about the three directives
7.24 Scriptlets considered harmful?
7.25 There didn't used to BE an alternative.
7.26 EL: the answer to, well, everything.
7.27 Sneak peek at EL
7.28 Using
7.29 You can choose to ignore EL
7.30 But wait... there's still another JSP element we haven't seen: actions
7.31 Coffee Cram: Mock Exam Chapter 7
7.32 Coffee Cram: Chapter 7 Answers
Chapter 8: Scriptless JSP: Script-free pages
8.1 Our MVC app depends on attributes
8.2 But what if the attribute is not a String, but an instance of Person?
8.3 We need more code to get the Person's name
8.4 Person is a JavaBean, so we'll use the bean-related standard actions
8.5 Deconstructing and
8.6 can also CREATE a bean!
8.7 You can use
8.8 can have a body!
8.9 Generated servlet when has a body
8.10 Can you make polymorphic bean references?
8.11 Adding a type attribute to
8.12 Using type without class
8.13 The scope attribute defaults to "page"
8.14 Going straight from the request to the JSP without going through a servlet...
8.15 The param attribute to the rescue
8.16 But wait ! It gets even better...
8.17 If you can stand it, it gets even BETTER...
8.18 Bean tags convert primitive properties automatically
8.19 But what if the property is something OTHER than a String or primitive?
8.20 Trying to display the property of the property
8.21 Expression Language (EL) saves the day!
8.22 Deconstructing the JSP Expression Language (EL)
8.23 Using the dot (.) operator to access properties and map values
8.24 The [] operator is like the dot only way better
8.25 The [] gives you more options...
8.26 Using the [] operator with an array
8.27 A String index is coerced to an int for arrays and Lists
8.28 For beans and Maps you can use either operator
8.29 If it's NOT a String literal, it's evaluated
8.30 You can use nested expressions inside the brackets
8.31 You can't do ${foo.1}
8.32 EL renders raw text, including HTML
8.33 The EL implicit objects
8.34 Request parameters in EL
8.35 What if you want more information from the request?
8.36 The requestScope is NOT the request object
8.37 Scope implicit objects can save you
8.38 Getting Cookies and init params
8.39 Imagine you want your JSP to roll dice
8.40 Deploying an app with static functions
8.41 And a few other EL operators...
8.42 EL handles null values gracefully
8.43 JSP Expression Language (EL) review
8.44 Reusable template pieces
8.45 The include directive
8.46 The standard action
8.47 They're NOT the same underneath...
8.48 The include directive happens at translation time happens at runtime
8.49 The include directive at first request
8.50 The standard action at first request
8.51 Uh-oh. She's right...
8.52 The way we SHOULD have done it
8.53 Customizing the included content with
8.54 The standard action
8.55 A conditional forward...
8.56 How it runs...
8.57 With , the buffer is cleared BEFORE the forward
8.58 Bean-related standard action review
8.59 The include review
8.60 Coffee Cram: Mock Exam Chapter 8
8.61 Coffee Cram: Chapter 8 Answers
Chapter 9: Using JSTL: Custom tags are powerful
9.1 EL and standard actions are limited
9.2 The case of the disappearing HTML (reprised)
9.3 There's a better way: use the tag
9.4 Null values are rendered as blank text
9.5 Set a default value with the default attribute
9.6 Looping without scripting
9.7
9.8 Deconstructing
9.9 You can even nest tags
9.10 Doing a conditional include with
9.11 But what if you need an else?
9.12 The tag won't work for this
9.13 The tag and its partners and
9.14 The tag... so much cooler than
9.15 Using with beans and Maps
9.16 Key points and gotchas with
9.17 just makes sense
9.18 With , there are now THREE ways to include content
9.19 can reach OUTSIDE the web app
9.20 Customizing the thing you include
9.21 Doing the same thing with
9.22 for all your hyperlink needs
9.23 What if the URL needs encoding?
9.24 You do NOT want your clients to see this:
9.25 Make your own error pages
9.26 Configuring error pages in the DD
9.27 Error pages get an extra object: exception
9.28 The tag. Like try/catch...sort of
9.29 You can make the exception an attribute
9.30 What if you need a tag that's NOT in JSTL?
9.31 Using a tag library that's NOT from the JSTL
9.32 Making sense of the TLD
9.33 Using the custom "advice" tag
9.34 The custom tag handler
9.35 Pay attention to
9.36 is NOT just for EL expressions
9.37 What can be in a tag body
9.38 The tag handler, the TLD, and the JSP
9.39 The taglib is just a name, not a location
9.40 The Container builds a map
9.41 Four places the Container looks for TLDs
9.42 When a JSP uses more than one tag library
9.43 Coffee Cram: Mock Exam Chapter 9
9.44 Coffee Cram: Chapter 9 Answers
Chapter 10: Custom Tag Development: When even JSTL is not enough...
10.1 Includes and imports can be messy
10.2 Tag Files: like include, only better
10.3 But how do you send it parameters?
10.4 To a Tag File, you don't send request parameters, you send tag attributes!
10.5 Aren't tag attributes declared in the TLD?
10.6 Tag Files use the attribute directive
10.7 When an attribute value is really big
10.8 Declaring body-content for a Tag File
10.9 Where the Container looks for Tag Files
10.10 When you need more than Tag Files... Sometimes you need Java
10.11 Making a Simple tag handler
10.12 A Simple tag with a body
10.13 The Simple tag API
10.14 The life of a Simple tag handler
10.15 What if the tag body uses an expression?
10.16 A tag with dynamic row data: iterating the body
10.17 A Simple tag with an attribute
10.18 What exactly IS a JspFragment?
10.19 SkipPageException: stops processing the page...
10.20 SkipPageException shows everything up to the point of the exception
10.21 But what happens when the tag is invoked from an included page?
10.22 SkipPageException stops only the page that directly invoked the tag
10.23 You still have to know about Classic tag handlers
10.24 Tag handler API
10.25 A very small Classic tag handler
10.26 A Classic tag handler with TWO methods
10.27 When a tag has a body: comparing Simple vs. Classic
10.28 Classic tags have a different lifecycle
10.29 The Classic lifecycle depends on return values
10.30 IterationTag lets you repeat the body
10.31 Default return values from TagSupport
10.32 OK, let's get real...
10.33 Our dynamic tag isn't complete...
10.34 We could just add more custom tag attributes...
10.35 Son of more tag attributes
10.36 The return of the son of more tag attributes
10.37 I'm getting sick of these tag attributes!
10.38 Our tag handler code using the DynamicAttributes interface
10.39 The rest of the tag handler code
10.40 OK, there is a little bit of configuration in the TLD
10.41 What about Tag Files?
10.42 But what if you DO need access to the body contents?
10.43 With BodyTag, you get two new methods
10.44 With BodyTag, you can buffer the body
10.45 What if you have tags that work together?
10.46 A Tag can call its Parent Tag
10.47 Find out just how deep the nesting goes...
10.48 Simple tags can have Classic parents
10.49 You can walk up, but you can't walk down...
10.50 Getting info from child to parent
10.51 Menu and MenuItem tag handlers
10.52 Getting an arbitrary ancestor
10.53 Using the PageContext API for tag handlers
10.54 Coffee Cram: Mock Exam Chapter 10
10.55 Coffee Cram: Chapter 10 Answers
Chapter 11: Web App Deployment: Deploying your web app
11.1 The Joy of Deployment
11.2 What goes where in a web app
11.3 WAR files
11.4 What a deployed WAR file looks like
11.5 Making static content and JSPs directly accessible
11.6 How servlet mapping REALLY works
11.7 Servlet mappings can be "fake"
11.8 Subtle issues...
11.9 Configuring welcome files in the DD
11.10 How the Container chooses a welcome file
11.11 Configuring error pages in the DD
11.12 Configuring servlet initialization in the DD
11.13 Making an XML-compliant JSP: a JSP Document
11.14 Memorizing the EJB-related DD tags
11.15 Memorizing the JNDI DD tag
11.16 Memorizing the DD tag
11.17 Coffee Crem: Mock Exam Chapter 11
11.18 Coffee Crem: Chapter 11 Answers
Chapter 12: Web App Security: Keep it secret, keep it safe
12.1 The Bad Guys are everywhere
12.2 And it's not just the SERVER that gets hurt...
12.3 The Big 4 in servlet security
12.4 A little security story
12.5 How to Authenticate in HTTP World: the beginning of a secure transaction
12.6 A slightly closer look at how the Container does Authentication and Authorization
12.7 How did the Container do that ?
12.8 Keep security out of the code!
12.9 Who implements security in a web app?
12.10 The Big Jobs in servlet security
12.11 Just enough Authentication to discuss Authorization
12.12 Authorization Step 1: defining roles
12.13 Authorization Step 2: defining resource/method constraints
12.14 The rules for elements
12.15 Picky rules for sub-elements
12.16 The way works
12.17 How multiple elements interact
12.18 Dueling elements
12.19 Alice's recipe servlet, a story about programmatic security...
12.20 Customizing methods: isUserInRole()
12.21 The declarative side of programmatic security
12.22 Authentication revisited
12.23 Implementing Authentication
12.24 Form-Based Authentication
12.25 Summary of Authentication types
12.26 She doesn't know about J2EE's "protected transport layer connection"
12.27 Securing data in transit: HTTPS to the rescue
12.28 How to implement data confidentiality and integrity sparingly and declaratively
12.29 Protecting the request data
12.30 Coffee Cram: Mock Exam Chapter 12
12.31 Coffee Cram: Chapter 12 Answers
Chapter 13: Filters and Wrappers: The Power of Filters
13.1 Enhancing the entire web application
13.2 How about some kind of "filter"?
13.3 Filters are modular, and configurable in the DD
13.4 Three ways filters are like servlets
13.5 Building the request tracking filter
13.6 A filter's life cycle
13.7 Think of filters as being "stackable"
13.8 Declaring and ordering filters
13.9 News Flash: As of version 2.4, filters can be applied to request dispatchers
13.10 Compressing output with a response-side filter
13.11 Architecture of a response filter
13.12 But is it really that simple?
13.13 The output has left the building
13.14 We can implement our OWN response
13.15 Wrappers rock
13.16 Adding a simple Wrapper to the design
13.17 Add an output stream Wrapper
13.18 The real compression filter code
13.19 Compression wrapper code
13.20 Compression wrapper, helper class code
13.21 Coffee Cram: Mock Exam Chapter 13
13.22 Coffee Cram: Chapter 13 Answers
Chapter 14: Patterns and Struts: Enterprise Design Patterns
14.1 Web site hardware can get complicated
14.2 Web application software can get complicated
14.3 Lucky for us, we have J2EE patterns
14.4 Performance (and the "ilities")
14.5 Aligning our vernaculars...
14.6 More design principles...
14.7 Patterns to support remote model components
14.8 How the Business Team supports the web designers when the MVC components are running on one JVM
14.9 How will they handle remote objects?
14.10 RMI makes life easy
14.11 Just a little more RMI review
14.12 Adding RMI and JNDI to the controller
14.13 How about a "go-between" object?
14.14 The "go-between" is a Business Delegate
14.15 Simplify your Business Delegates with the Service Locator
14.16 Protecting the web designer's JSPs from remote model complexity
14.17 Compare the local model diagram to this remote model diagram
14.18 There's good news and bad news...
14.19 Time for a Transfer Object?
14.20 Business tier patterns: quick review
14.21 Our very first pattern revisited... MVC
14.22 MVC in a real web app
14.23 Looking at the MVC controller
14.24 Improving the MVC controllers
14.25 Designing our fantasy controller
14.26 Yes! It's Struts in a nutshell
14.27 Is Struts a container?
14.28 How does Front Controller fit in?
14.29 Refactoring the Beer app for Struts
14.30 The Struts Beer app architecture
14.31 A form bean exposed
14.32 How an Action object ticks
14.33 struts-config.xml: tying it all together
14.34 Specifying Struts in the web.xml DD
14.35 Install Struts, and Just Run It!
14.36 Creating the deployment environment
14.37 Patterns review for the SCWCD
14.38 Business Delegate
14.39 Service Locator
14.40 Transfer Object
14.41 Intercepting Filter
14.42 Model, View, Controller (MVC)
14.43 Front Controller
14.44 Coffee Cram: Mock Exam Chapter 14
14.45 Coffee Cram: Chapter 14 Answers
Final Mock Exam: Coffee Cram
Coffee Cram: Final Mock Exam
Coffee Cram: Final Exam Answers
"Man könnte das Thema Java Web Entwicklung nicht besser vermitteln. Inhaltlich und didaktisch nichts zu verbessern." -- Professor Dr. Carsten Dorrhauer, Berufsakademie Stuttgart, November 2008
"Man nehme zwei der Autoren des sehr erfolgreichen "Design Patterns von Kopf bis Fuß", zusätzlich ziehe man einen Softwareentwickler von Sun hinzu, der Kompetenzen im Bereich Web Development besitzt, werfe all diese drei zusammen und herauskommt das wohl ungewöhnlichste Buch, das je zu einem J2E-Thema verfasst wurde. [...] Das Buch erweist sich insbesondere durch seine locker-flockige Struktur, den flapsigen Kommentaren und nicht zu letzt aufgrund des Wechsels zwischen Theorie und Praxis als überaus empfehlenswert. Sowohl für jene, die das SCWCD-Examen bestehen wollen, als auch jene Leser, die sich aus eigenem Antrieb mit der Materie erstmalig zu befassen gedenken. [...] das grundlegende Procedere, die Basistechnologien und wie diese gekoppelt und eingesetzt werden, vermag das Buch auf sehr gekonnte, alt bewährte und kurzweilige Weise zu vermitteln. Abermals ein Buch, das den hohen Anspruch des O'Reilly-Verlags bestätigt." -- webcritics.de, September 2008 (zu der englsichen Originalausgabe)
"Man nehme zwei der Autoren des sehr erfolgreichen "Design Patterns von Kopf bis Fuß", zusätzlich ziehe man einen Softwareentwickler von Sun hinzu, der Kompetenzen im Bereich Web Development besitzt, werfe all diese drei zusammen und herauskommt das wohl ungewöhnlichste Buch, das je zu einem J2E-Thema verfasst wurde. [...] Das Buch erweist sich insbesondere durch seine locker-flockige Struktur, den flapsigen Kommentaren und nicht zu letzt aufgrund des Wechsels zwischen Theorie und Praxis als überaus empfehlenswert. Sowohl für jene, die das SCWCD-Examen bestehen wollen, als auch jene Leser, die sich aus eigenem Antrieb mit der Materie erstmalig zu befassen gedenken. [...] das grundlegende Procedere, die Basistechnologien und wie diese gekoppelt und eingesetzt werden, vermag das Buch auf sehr gekonnte, alt bewährte und kurzweilige Weise zu vermitteln. Abermals ein Buch, das den hohen Anspruch des O'Reilly-Verlags bestätigt." -- webcritics.de, September 2008 (zu der englsichen Originalausgabe)