Course Description
Servlets and JSP (JavaServer Pages™) are key server-side Java™
technologies for building web applications. Servlets are programs that
run on a web server; they can respond to client requests and create
dynamic content. JSPs are useful for displaying dynamic data, and
allowing Java developers and Web page designers to work together easily.
The JSTL is a tag library for JSP that encapsulates the core
functionality common to many Web applications using custom tags. These
include tags for iteration, conditionals, XML manipulation and much
more.
This course is a comprehensive tutorial in the design and programming
of Java Web applications using servlets and JSP. It starts with Web
application architecture, usage, and deployment. It teaches about the
capabilities of servlets, servlet architecture, and session management,
JSP structure and syntax, and good design techniques for using them.
Extensive coverage is included on how to efficiently use the JSP
Expression Language (EL), custom tags, and the JSTL library. The course
is current with the latest releases of the specification, and uses the
latest capabilities to write Web applications in the most efficient way
possible. This includes the use of the JSP Expression Language directly
in JSP 2.0+ Web pages, an overview of creating custom tags with tag
files, and other new capabilities that make the framework much more user
friendly. The complete course will give you excellent experience on how
to build robust and capable Web applications using the latest features
of the Java EE Web container. All labs can be done with the Eclipse IDE
Java EE version, and the lab instructions include detailed directions
for using it.
This course will also teach Java web developers how to create
JavaServer Faces (JSF) 2.0 based web applications. After a quick
introduction to the technology, students will learn how to create
managed beans and how to use the JSF Core and HTML tag libraries to
generate dynamic HTML content. They will then learn the JSF lifecycle
and how to trigger server-side event handler code. Next, students will
learn how to use the Data table component to easily display large
amounts of data in an HTML table. The course continues with coverage of
validation and conversion, including customization of these phases.
Finally, students will learn how to use the JSF 2.0 Ajax capabilities.
Audience
- Developers and designers interested in advancing their knowledge of Servlets, JSPs, and JSTL.
- Web developers who want to efficiently create complex web applications with JSF 2.0
Prerequisites
- HTML, and XML programming experience is recommended.
- Java Programming, Java Web Programming, and familiarity with HTML
- JV002 – Java Programming Language or equivalent knowledge
Duration
Course Outline
1. Web Application Basics & Getting Started with JSF
- How the Web Works
- Clients and Servers
- HTML – The Language of the Web
- HTTP, Addressing, Requests, and Responses
- Browsing a Simple Web Page
- Java EE – Java Enterprise Edition Basics
- Simple Web-Based Architecture
- Java EE Web Applications
- Web Application Structure
- A Simple Servlet
- Servlets and Dynamic Content
- What Are Servlets?
- How a Servlet Runs
- Advantages of Servlets
- Packages and Classes
- Creating a Servlet – The Simplest Way
- A Simple HTTP Servlet
- Declaring and Mapping Servlets
- GUI Development
- JavaServer Faces
- A JSF Application
- JSF Components
- Managed Beans
- JSF Application Structure
- Running the Application
2. Servlet Basics & Managed Beans
- HTML Forms and HTTP Review
- HTML Forms
- A Simple Search Form in HTML
- HTTP Request and Response Details
- GET and POST Methods
- Request Parameters
- How Servlets Work
- Servlet Interface and Servlet Lifecycle
- Servlet Lifecycle – Initialization
- Servlet Lifecycle – The service() Method
- Important Types for Servlets
- Class Diagram for Servlet Types
- Class GenericServlet
- Requests and Responses
- Important ServletRequest / Respoonse Methods
- Getting Data / Sending Responses
- Getting Data and Sending Response
- HTTP Servlets
- Class HttpServlet
- HttpServletRequest Interface
- More About web.xml
- Look at the JAVADOC
- Managed Beans and MVC
- Properties
- Managed Bean Annotations
- Bean Scope Annotations
- Value Expressions
- Method Expressions
3. Additional Servlet Capabilities & JSF Tag Libraries
- HTTP Responses – Status and Errors
- HttpServletResponse Status/Error Methods
- HTTP Response Headers
- Setting Response Headers
- MIME Types
- Specifying a MIME Type
- Initialization Overview
- The ServletConfig Interface
- The ServletContext Interface
- Declaring and Mapping Servlets
- Servlet Init Parameters
- A Problem with SearchServlet
- Null and Empty String Parameters
- Error Handling
- Specifying Error Pages
- Error Page Configuration
- Error Handling
- The JSF Component Tree
- JSF Tag Libraries
- Resources
- Forms
- Input Tags
- Output Tags
- Submitting Form Data with HTTP Post
- View Parameters
- Passing Data with HTTP Get
- Checkboxes
- Radio Buttons, Listboxes, and Menus
- Panels
4. JavaServer Pages (JSP) & JSF Lifecycle and Event Handling
- Shortcomings of Servlets
- What is a JSP?
- A Very Simple JSP – simple.jsp
- JSPs Look Like HTML
- JS{ Expressions
- JSP Comments
- JSPs are Really Servlets
- The Generated Servlet
- Model View Controller (MVC) Architecture
- Servlet and JSP Architecture
- Model View controller (MVC)
- Servlets as the Controller
- JSP as the View
- JavaBeans as the Glue and the Model
- Servlets as Controllers
- RequestDispatcher
- Servlets as Controller
- Forwarding to a Resource
- Including Output of Another Resource
- RequestDispatcher Paths
- Data Sharing Among Servlets and JSPs
- Object Bucket or Scopes
- Using the Scope Objects
- JSP and JavaBeans
- Putting Data on a Scope
- The Other Scopes
- Careful – Servlets are Multi-Threaded
- JSP Expression Language and Data Access
- JSP Expression Language (EL)
- Data Objects and the EL
- JavaBeans and the EL
- Implicit Objects (Predefined EL Variables)
- JSP Mixes Dynamic and Template Data
- <jsp:useBean>
- JavaBean Properties
- JSP Directives
- The Include Directive – <%@include%>
- The Include Action – <jsp:include>
- <jsp:forward> Action
- The Page Directive
- JSF Lifecycle Overview
- Restore View Phase
- Apply Request Values Phase
- Process Validation Phase
- Update Model Values Phase
- Invoke Application Phase
- Render Response Phase
- JSF Events
- Action Events
- Value Change Events
- Immediate Events
5. Using Custom Tags & Data Table Component
- Custom Tag Libraries Overview
- Issues with Vanilla JSP
- Sun’s Solution – Custom Tags
- Custom Tag Overview
- Tag Libraries
- Using a Tag Library in a web Application
- Taglib Definition – How it Works
- More About URIs and Prefixes
- JSP Standard Tag Library (JSTL)
- Need for Iteration
- Using the c:param Tag for URL Parameters
- Using c:param with c:url
- Data Tables
- Basic Structure
- Facets
- Styles
- Adding Editable Components
- DataModel
- Sorting
- Scrolling
6. HTTP Session Tracking & Validators and Converters
- HTTP Session Overview
- HTTP is a Stateless Protocol
- Online Shopping with a Stateless Protocol
- Storing Contextual Information
- Hidden Form Fields
- Cookies
- Cookie Details
- Accessing Cookies with the Servlet API
- Persistent Cookies and Session Cookies
- Cookie Usability Issues
- Sessions
- Servlet JSP Sessions
- Using Sessions
- How Session Tracking Works
- Sessions and Cookies – How They Work
- Validation and Conversion within the JSF Lifecycle
- Converting Dates
- Converting Numbers
- Displaying Conversion Errors
- Built-In Validators
- Customizing Error Messages
- Writing Your Own Converter
- Custom Converter Configuration
- Writing Your Own Validator
7. More JSP Capabilities & Ajax
- Error Pages
- Servlet Exceptions and Error Pages
- The Implicit Exception Object
- JSP 2.0 Error Handling
- Using ErrorData
- Exception Handling in a JSP
- web.xml – Declarative Exception Handling
- Server Logging
- JSPs as XML Files
- JSP Pages as XML Documents
- Java Scriptlets
- Scriptlets
- How do Scriptlets Works?
- Another Simple JSP – simple.jsp
- Generated Code Fragment for simple.jsp
- When to Use Scriptlets
- Declarations
- Ajax and JSF
- Events
- Execute and Render
- Grouping
- Validation
- The onevent Attribute
- The onerror Attribute
- The listener Attribute
8. More JSTL, EL & Appendix A – Internationalization
- More About JSTL
- JSTL Tag Libraries at a Glance
- Custom Tag Architecture
- More About JSTL URIs and Prefixes
- Some Other Common Core Actions
- Formatting Library
- SQL Library XML Library
- JSTL 1.1 Functions Library
- JSTL Function Library
- More About the JSP EL
- EL Syntax
- EL Identifiers
- EL Operators
- . and () Operators
- JSP EL Implicit Objects
- PageContext Properties
- JSP EL Literal Values
- Conditional Operator
- Using Common Tags
- Putting JSTL and EL in JSP
- Using <c:if>
- <c:if> Test Expressions
- <c:choose>
- More on <c:foreach>
- <c:set>
- <fmt:formatdate>
- <fmt:formatnumber>
- JSTL-EL Resources
- I18NandL10N
- Resource Bundles
- Configuring a Resource Bundle
- Using a Resource Bundle
- Specifying the Locale
- I18N in Custom Code
- Dates and Numbers
9. Security & Appendix B – faces-config.xml Navigation
- Java EE Security Overview
- Security Requirements
- Java EE Security
- Web Tier Security in Java EE
- Transport Level Security with HTTPS/SSL
- Declarative Security
- Declarative Role-Based Security
- Specifying Security constraints
- Security Constraints – Deployment Descriptor
- Mapping Users to Roles
- Security – The Big Picture
- Web Authentication
- HTTP Basic Authentication
- HTTP Basic Authentication on the Browser
- Configuring Basic Authentication
- Basic Authentication Pros and Cons
- Form Based Authentication
- Using Form Based Authentication
- Form Based Authentication Pros and Cons
- Digest Authentication
- Digest Authentication Pros and Cons
- HTTPS Client Authentication
- Programmatic Security
- Programmatic Security – HttpServletRequest
- Navigating Through a JSF Application
- Basic Navigation Configuration
- From View ID
- From Action
- Forward vs. Redirect
10. Additional Topics
- Design Issues
- Divide and Conquer
- Minimize Network Overhead
- Scalability – Clustering
- Sessions and Clustering
- Scalability – Separating Static Content
- Scalability – Java Virtual Machine
- Scalability – CPUs and 64 Bit Machines
- Maintainability – Write Your JSPs Well
- Use the Technology Wisely
- Use a Framework
- The Java Blueprints
- Custom Tags Using Tag Files
- Creating Custom Tags with Tag Files
- Adding Attributes to Tags
- The Tag Directive
- Other Tag File Capabilities
- Servlet Filter Overview
- Filter API
- Filter Processing
- Filter Chain
- A Simple Filter
- Filter is Mapped in the web.xml file
- How a Filter Can Modify a request or Response
- The Way a Response Normally Works
- Manipulating the Response
- Wrapping the Response
- JavaServer Faces (JSF) Overview
- Vanilla Servlet/JSP Shortcomings
- JavaServer Faces
- JSF Architecture
- JSF Capabilities
- JSF Components
- The UI Runs on the Server
- Event Handling
- Process Flow
- JSF Advantages
- JSF Disadvantages