Objectives
  After completing this course, the student should be able to:
  • Use Eclipse as an truly integrated development environment
  • Build servlets according to the current Servlet 2.3 specification
  • Build JSPs according to the current JSP 1.2 specification
  • Build custom JSP tag libraries
  • Integrate servlets and JSPs into a complete J2EE application
  • Deploy a J2EE application to JBoss
Topics
 
  • Develop and test servlets
  • Develop and test JavaServer Pages (JSPs)
  • Develop and test J2EE applications following the Model/View/Controller architecture
  • Integrate business logic using Java Beans and Java Database Connectivity (JDBC)
  • Apply best practices to Servlet and JSP development
Audience
  Java programmers who build server-side web applications interested in leveraging Eclipse and JBoss to streamline their development cycle.
Prerequisites
 
  • Students should understand essential concepts of Object-Oriented Programming and be able to write simple Java programs with assistance.
Duration
  Five days.
Lab Setup Guide

Outline for Servlet/JSP Programming Using Eclipse/JBoss-IDE and JBoss Training

1. J2EE Overview

 
  • Java Web Applications
  • Java Web Application Architecture
  • J2EE Architecture
  • Web Application Programming Model MVC
  • An MVC Example
  • The Infrastructure for Enterprise Web Applications
  • Summary
 

2. JavaScript Overview: History and Today

 
  • JavaScript Overview
  • Fundamentals: Part 1
  • Fundamentals: Part 2
 

3. JavaScript Interactivity

 
  • HTML Forms and JavaScript
 

4. Servlet Basics

 
  • Objectives
  • History CGI
  • Server Extension APIs
  • Java Servlet
  • Servlet Container
  • Servlet Responsibilities
  • J2EE and Servlet
  • The Servlet Class
  • The HttpServlet Class
  • An Example Hello World
  • The Servlet Container
  • The Servlet API
  • Life Cycle Initialization
  • Life Cycle Initialization
  • Example Initialization
  • Life Cycle Processing
  • Life Cycle Processing
  • Life Cycle Destroy
  • User Input
  • Example User Input
  • Output to Client
  • Servlet Error Handling
  • Threading Issues
 

5. Servlet Interaction Interface

 
  • Objectives
  • Request
  • Request Parameters
  • Request Attributes
  • Request Headers
  • Request Path
  • Other Request Information
  • Response
  • Cookies
  • Setting Cookies
  • Servlet Context
  • Servlet Context Attributes
  • Resource
  • Session Tracking
  • Tracking Techniques
  • Cookies
  • Cookies an Example
  • HTML Hidden Fields
  • Using HttpSession
  • Session Invalidation
  • An Example of Session Tracking Code...
  • An Example of Session Tracking Code
  • An Example of Session Tracking Code
  • An Example of Session Tracking Code
  • An Example of Session Tracking Code
  • An Example of Session Tracking Code
  • An Example of Session Tracking Code
  • HttpSession - URL Rewriting
  • Summary
 

6. JavaServer Page (JSP) Basics

 
  • Objectives
  • JavaServer Pages
  • A Simple Example - Hello.jsp
  • JSP Benefits
  • Evolution of Dynamic Content Technologies
  • How JSP Works
  • JSP Invocation
  • JSP Scripting Elements
  • The XML Syntax
  • JSP Directive
  • page Directive Attributes
  • page Directive an Example
  • page Attribute errorPage
  • page Attribute isErrorPage
  • Using XML Syntax
  • Directives include
  • Include an Example
  • Include an Example
  • Include at compile time vs. at request time
  • Request time inclusion
  • JSP Declarations
  • Declarations an Example
  • JSP Expressions
  • JSP Expressions an Example
  • JSP Scriptlets
  • JSP Scriptlets an Example
  • JSP Scriptlets an Example
  • JSP Comments
  • JSP Predefined Variables
  • The request Object
  • The response Object
  • The out Object
  • Out an Example
 

7. Using Java Beans with JSP

 
  • Objectives
  • What is a JavaBean?
  • Structure of a JavaBean
  • Life Cycle
  • Properties
  • Very Simple Bean
  • Using Java Beans in JSP
  • The < jsp:useBean > tag
  • Java Bean scope
  • < jsp:useBean > in Action
  • The < jsp:getProperty > tag
  • The < jsp:setProperty > tag
  • Mapping all the request parameters
  • Another Example
  • Mixing Scriptlets and Bean tags
 

8. JSP Programming Techniques

 
  • Objectives
  • Error Handling
  • Example Exception Handling
  • Using an Error Page
  • Form Validation Client Side
  • Form Validation Client Side
  • Form Validation Client Side
  • Form Validation Server Side
  • Form Validation Server Side
  • Session Tracking
 

9. Servlet Programming - Advanced

 
  • Objectives
  • Key Issues for Web Application Development Productivity
  • Web Application Programming Model MVC
  • Model
  • View
  • Controller
  • What is JDBC?
  • JDBC Architecture
  • JDBC: Basic Steps
  • Loading a Driver
  • DB2 UDB JDBC Drivers
  • Oracle JDBC Drivers
  • Create a Connection
  • Connection
  • Statement
  • PreparedStatement
  • ResultSet
  • ResultSet
  • ResultSet
  • Example JDBC Servlet With Transactions
  • Close the Connection
  • Need for Connection Pooling
  • Connection Pooling in JDBC 2.0
  • Connection Pooling
  • Basic Steps in Using JDBC Connection Pooling
  • Access a DataSource
  • Get a Connection
  • Release Connections
  • Connection Pool Example
  • Resource References
  • JavaBeans
  • MVC Implementation
  • Request Dispatching
  • Request Dispatching - Forward vs. Include
  • HTTP Redirection
  • Dispatch vs. redirection
  • Integrating Servlet and JSP
  • Calling a JSP from a Servlet
  • Request Dispatching - forward Request to JSP
  • Supply Result information to the JSP
  • A Simple Example
  • Display JavaBean Properties in JSP
 

10. Web Applications and MVC

 
  • Objectives
  • Tiered Architectures
  • Presentation Layer
  • Presentation Layer
  • Presentation Layer
  • Presentation Layer
  • Middle Tier
  • Model View Controller
  • Extensible Markup Language
  • XML
 

11. Servlet Filters

 
  • Objectives
  • What is a filter?
  • Why use a filter?
  • Uses for Filtering
  • Features of filters
  • The Filter interface
  • How a filter works
  • In what order?
  • A simple logging filter
  • Configuring the filter
  • Mapping the filter
  • The Web Deployment Descriptor
  • Common filter tasks
  • Request and Response Wrappers
 

12. Struts Architecture and Overview

 
  • Objectives
  • Review: MVC Model
  • Review: Request, Session and Application
  • What is Struts?
  • Struts Flow
  • Components in Struts
  • The Model
  • The View
  • The Controller
  • Struts Flow
  • struts-config.xml
  • struts-config.xml Content
  • The <data-sources> element in the struts-config.xml
  • The <form-beans> element in the struts-config.xml
  • The <global-forwards> element in the struts-config.xml
  • The <action-mappings> element in the struts-config.xml
  • Sample struts-config.xml
  • The Role of web.xml for the Application
  • Configuring Struts in the web.xml
  • web.xml Content
  • Steps to Configuring Struts in the web.xml
  • Step 1. Configuring the Action Servlet Instance in the web.xml
  • Action Servlet Config Example
  • Step 2. Configuring the Action Servlet Mapping in web.xml
  • Prefix Mapping Example
  • Extension Mapping Example
  • Step 3. Configuring the Struts Tag Libraries in the web.xml
  • Sample web.xml
  • Summary
 

13. Custom Tag Libraries

 
  • Introduction
  • Tag Attributes
  • Tag Body
  • Tag Library Descriptor
  • Tag Library Descriptor Details
  • carPrice.tld
  • The Java Server Page
  • Writing a Simple Tag Handler Class
  • Tag Handler Life Cycle
  • Rendering Content
  • Implementing Empty Body Tag
  • Example: CarPriceHandler
  • CarPriceHandler
  • carPrice.jsp
  • Implementing a Tag With Unprocessed Body
  • Handling Tag Bodies
  • Implementing Body Processing
  • Example: Body Tag Support
  • Implementing an Iteration Tag
  • Nested Tags
  • Summary
 

Appendix A. Tag Handlers

 
  • Tag Library API
  • Tag Interface
  • BodyTag Interface
  • Tag Handler Class
  • Tag Handler Lifecycle
  • TagSupport Class
  • The pageContext variable
  • An example
  • Exception Handling
 

Appendix B. Advanced Tag Library Features

 
  • Manipulating Tag Body
  • Repeating over Tag
  • Nested Tags
 

Appendix C. Quick HTML Reference

 
  • Head and Body
  • The Title Tag
  • Heading Levels
  • Bold Text
  • Italicized Text
  • Underlined Text
  • Sub/Super-scripted Text
  • Combining Tags
  • Spacing
  • Layout Tags
  • The Break Tag
  • The Paragraph Tag
  • Pre-formatted Text
  • Drawbacks of
  • Comments
  • Linking
  • Linking and the Anchor
  • Linking to an Email
  • Images
  • Image Alignment
  • Background Images
  • Colors
  • Setting Foreground and Background
  • RGB Color Codes
  • Lists
  • Unordered Lists
  • Unordered Lists - Example
  • Ordered Lists
  • Ordered Lists - Example
  • Tables
  • Table - Example
  • Frames
  • < frameset >
  • < frameset > - Example
  • < frame >
  • < frame > - Example
  • Names and Targets
  • < noframes >
 

Appendix D. Introduction to HTTP

 
  • HTTP Overview
  • HTTP Overview: Continue
  • HTTP Overview: Continue
  • HTTP Requests
  • HTTP Request Header
  • HTTP Responses
  • HTTP Response Header
  • HTTP Response Header: Continue
  • Common GateWay Interface (CGI)
  • Common GateWay Interface (CGI): Continue
  • Common GateWay Interface (CGI): Continue
  • Common GateWay Interface (CGI): Continue
  • Common GateWay Interface (CGI): Continue
 

Appendix E. Tomcat

 
  • Objectives
  • Tomcat Installation
  • Installation Troubleshooting
  • Starting Tomcat Server
  • Accessing Tomcat
  • Configuring Tomcat
  • Using the Tomcat Admin Console
  • Tomcat Administration
  • Tomcat Manager
  • Logging
  • Summary
 

Appendix F. Building an Application with ANT

 
  • What is Ant?
  • Ant details
  • Installing Ant
  • build.xml
  • Ant build file
  • How to run Ant?
  • Understand build.xml
  • Understand build.xml (continued)
  • Ant Tasks
  • Advanced Task
  • Ant Folders
  • Summary
 

Appendix G. XML Fundamentals

 
  • Topics
  • Data and Document Structure
  • Markup Languages
  • What is XML ?
  • XML Overview
  • Simple Case Study
  • An Employee Document
  • Tags
  • First XML
  • Why XML?
  • XML Document
  • An Example of XML Document
  • Sections of an XML Document
  • XML Elements
  • Naming Rules
  • Nesting and Hierarchy of XML Elements
  • Attributes
  • Empty and Non-Empty Elements
  • Namespaces for Elements and Attributes
  • Other XML Tags
  • Entity References
  • Character References
  • Well-formed vs. Valid XML Document
  • Document Type Definition DTD
  • Enforcing Validity DTDs
  • Presentation Style
  • Processing Instructions
  • Is the XML Declaration a Processing Instruction ?
  • XML Parsers
  • SAX
  • Pros and Cons of Using SAX
  • DOM
 

Appendix H. Cascading Style Sheets

 
  • Cascading Style Sheets
  • The xml-stylesheet processing instruction
  • CSS details
  • An example
  • Common CSS tags display
  • Common CSS tags Colors and Backgrounds
  • Common CSS tags Fonts