1. Copyright Š 2002 ProsoftTraining. All rights reserved.
Java Servlets
2. Copyright Š 2002 ProsoftTraining. All rights reserved.
Lesson 1:
Introduction
to Java Servlets
3. Objectives
⢠Describe the differences between servlets and
other Web application technologies
⢠Explain the difference between the GET and
POST methods of making an HTTP request
⢠Create a simple servlet using GET
⢠Create a simple servlet using POST
⢠Define a simple deployment descriptor
4. Introduction
to Web Applications
⢠Web application technologies
â Common Gateway Interface (CGI)
â Server extensions
â Server-side scripting
â JavaServer Pages
â Java servlets
9. Summary
ďź Describe the differences between servlets and
other Web application technologies
ďź Explain the difference between the GET and
POST methods of making an HTTP request
ďź Create a simple servlet using GET
ďź Create a simple servlet using POST
ďź Define a simple deployment descriptor
10. Copyright Š 2002 ProsoftTraining. All rights reserved.
Lesson 2:
The Servlet Life Cycle
11. Objectives
⢠Describe the servlet life cycle
⢠Create init and destroy methods
⢠Retrieve servlet initialization parameters
⢠Use the SingleThreadModel interface
⢠Retrieve CGI environment variables
⢠Retrieve and use the ServletContext object
⢠Use temporary files
12. The
Multithreaded Model
⢠Servlets typically operate in a multithreaded
environment
â The Web server usually instantiates only
one instance of a servlet to serve all clients
⢠Deployment descriptors and the multithreaded
model
13. The
Single Thread Model
⢠The Web server guarantees that no two threads
will ever operate concurrently on the same servlet
instance
⢠To designate servlets to use the single thread
model, implement the following interface:
â javax.servlet.SingleThreadModel
14. The init
and destroy Methods
⢠The init method
â Initialization parameters and the
deployment descriptor
⢠The destroy method
17. Summary
ďź Describe the servlet life cycle
ďź Create init and destroy methods
ďź Retrieve servlet initialization parameters
ďź Use the SingleThreadModel interface
ďź Retrieve CGI environment variables
ďź Retrieve and use the ServletContext object
ďź Use temporary files
18. Copyright Š 2002 ProsoftTraining. All rights reserved.
Lesson 3:
Responding to a Request
19. Objectives
⢠Use client-side caching
⢠Use client pull to update a client
⢠Redirect the client to another URL
⢠Use persistent connections
⢠Use response status codes
⢠Return a file to a client
⢠Dynamically generate images
24. Summary
ďź Use client-side caching
ďź Use client pull to update a client
ďź Redirect the client to another URL
ďź Use persistent connections
ďź Use response status codes
ďź Return a file to a client
ďź Dynamically generate images
25. Copyright Š 2002 ProsoftTraining. All rights reserved.
Lesson 4:
Servlet Sessions
26. Objectives
⢠Track a session using hidden form fields
⢠Track a session using URL rewriting
⢠Track a session using cookies
29. Cookies
⢠Small pieces of information transmitted from a
Web server to a Web browser
⢠Represented in Java using the Cookie class
30. Summary
ďź Track a session using hidden form fields
ďź Track a session using URL rewriting
ďź Track a session using cookies
31. Copyright Š 2002 ProsoftTraining. All rights reserved.
Lesson 5:
Authentication
and Security
32. Objectives
⢠Authenticate a user using HTTP-based
authentication
⢠Authenticate a user using a form
⢠Use Secure Sockets Layer to improve security
34. Form
Authentication
⢠Requires modification of the deployment
descriptor
â The login-config element must be
modified to indicate that form
authentication is to be used and to provide
the URL for a login page and login error
page
35. Summary
ďź Authenticate a user using HTTP-based
authentication
ďź Authenticate a user using a form
ďź Use Secure Sockets Layer to improve security
36. Copyright Š 2002 ProsoftTraining. All rights reserved.
Lesson 6:
Inter-Servlet
Communication
40. Summary
ďź Share data with another servlet
ďź Handle a single request using multiple
servlets
41. Copyright Š 2002 ProsoftTraining. All rights reserved.
Lesson 7:
Building Enterprise
Web Applications
42. Objectives
⢠Use JNDI to look up EJBs, resource factories
and environment entries
⢠Write servlets for use in a distributed
environment
⢠Use JavaMail to send e-mail
45. JavaMail
⢠Add-on API that creates a full-fledged
POP/iMAP client
â Session class
â getDefaultInstance static method
46. Summary
ďź Use JNDI to look up EJBs, resource factories
and environment entries
ďź Write servlets for use in a distributed
environment
ďź Use JavaMail to send e-mail
47. Copyright Š 2002 ProsoftTraining. All rights reserved.
Lesson 8:
Internationalization
48. Objectives
⢠Use the Unicode escape sequence to specify
special Latin characters
⢠Use alternative character sets to generate a
non-Latin character response
51. Summary
ďź Use the Unicode escape sequence to specify
special Latin characters
ďź Use alternative character sets to generate a
non-Latin character response
52. Java Servlets
ďź Introduction to Java Servlets
ďź The Servlet Life Cycle
ďź Responding to a Request
ďź Servlet Sessions
ďź Authentication and Security
ďź Inter-Servlet Communication
ďź Building Enterprise Web Applications
ďź Internationalization