112. Introduction to
JavaServer Pages
Rev. 2.0.1
This course is now available directly from our partner, Capstone Courseware.
This two-day module introduces JavaServer Pages, or JSP, which is
the standard means of authoring dynamic content for Web applications under the
Java Enterprise platform. The module
begins with an introduction of Web applications in general, shows how Java
servlets and JSPs establish a framework for writing Web applications, and then
covers JSP 2.0 features in detail, from scripting elements to use of dedicated
JavaBeans to JSP expressions, and quick introductions of JSTL and custom tag
development.
By the end of the module students will be able to create their own
JSP applications, including interactive applications using HTML forms and pages
that perform fairly complex processing using scripts and or actions. Although scripting is covered, the scriptless
authoring style encouraged by the JSP 2.0 specification is emphasized, and
students will be well equipped to develop concise and effective JSP
applications.
LEARNING OBJECTIVES
·
Explain the fundamentals of HTML and HTTP in the
World Wide Web.
·
Describe the CGI and its role in implementing
interactive Web applications.
·
Describe JavaServer Pages and their relationship
to servlets and J2EE generally.
·
Describe how a JSP is translated into a servlet
and processed at runtime.
·
Explain the use of directives on JSPs and
outline the principal directives.
·
Implement simple JSPs that use Java code in
declarations, expressions and scriptlets.
·
Enumerate and use the implicit objects available
to scripting elements.
·
Explain the use of HTML forms in Web
applications.
·
Implement an interactive Web application using
JSP.
·
Use Java exception handling and JSP error pages
to handle errors in JSP applications.
·
Implement session management for a JSP
application.
·
Manage cookies to store client-specific
information at various scopes and durations.
·
Explain the use of JavaBeans in JSP and their
role in enhancing the separation of business logic from page design.
·
Use Beans to implement effective interactive JSP
applications.
·
Describe the use of the JSP expression language
in simplifying dynamic page output.
·
Write JSP expressions and implement JSPs that
use them in favor of scripts.
·
Describe the role of the JSP Standard Tag
Library in JSP development.
·
Implement JSPs that use basic JSTL actions to
simplify presentation logic.
·
Describe custom tags in JSP and explain how they
are implemented, both using Java and JSP itself, and how they are used.
·
Discuss threading issues in JSP and describe the
use of directives to control how threading is handled.
·
Describe the various uses of XML in JSP
applications.
·
Deploy a logical Web application to a Web server
in a WAR file.
Duration: 2 days.
Prerequisites: No formal prerequisites; knowledge of HTML and background in Web
applications, and/or Java programming experience, are helpful but not
necessary.
1.
Web Applications
The World Wide Web
HTML
Web Servers
HTTP
Dynamic Web Pages
CGI
Java Web Technologies
Servlets
JSP
2.
JSP Architecture
JSP Containers
Servlet Architecture
Page Translation
Types of JSP Content
Directives
Content Type
Buffering
Scripting Elements
JSP Expressions
Standard Actions
Custom Actions and JSTL
Objects and Scopes
Implicit Objects
JSP Lifecycle
3.
Scripting Elements
Translation of Template Content
Scriptlets
Expressions
Declarations
Dos and Don’ts
Implicit Objects for Scriptlets
The request Object
The response Object
The out Object
4.
Interactive JSP Applications
HTML Forms
Reading CGI Parameters
JSPs and Java Classes
Error Handling
Session Management
The Session API
Cookies and JSP
5.
Using JavaBeans
Separating Presentation and Business Logic
JSP Actions
JavaBeans
Working with Properties
<jsp:useBean>
<jsp:getProperty> and <jsp:setProperty>
Using Form Parameters with Beans
Objects and Scopes
Working with Vectors
6.
The Expression Language and the JSTL
Going Scriptless
The JSP Expression Language
EL Syntax
Type Coercion
Error Handling
Implicit Objects for EL
The JSP Standard Tag Library
Role of JSTL
The Core Actions
Using Beans with JSTL
The Formatting Actions
Scripts vs. EL/JSTL
7.
Advanced JSP Features
Web Components
Forwarding
Inclusion
Passing Parameters
Custom Tag Libraries
Tag Library Architecture
Implementing in Java or JSP
Threads
Strategies for Thread Safety
XML and JSP
JSP for Web Services
Learning Resources
System Requirements
This module can be presented on Windows or Linux systems. The J2SE SDK and the Tomcat 5 Web server are
required – both are free downloadables available for either platform. Hardware requirements are modest: a good
minimal system for this module would have a Pentium 500MHz or equivalent CPU,
256 meg of RAM and at least 500 megabytes of free disk space for tools
installation and lab software.