Duration: 5 Days
In this course, you will learn the fundamentals of Java, including language structures, OO concepts, and a sampling of tools, and you will get in-depth coverage of JavaServer Pages (JSP), including working with user data, and architectural considerations such as the use of JavaBeans. You will examine in detail the Java Database Connectivity (JDBC) API (across any RDBMS) and the APIs for XML processing.
What You Will Learn
- Run and compile Java programs
- Data types, language constructs, and flow control
- Classes, objects, and inheritance
- Use the JavaServer Pages environment to create dynamic pages and work with user data
- Use JavaBeans in your JSPs
- Manage state in web applications using the sessions and cookies
- Use JDBC to connect to and modify databases
- Use XML to transform data for web pages
- Fundamentals of JSTL and EL
- Work with Regular Expressions in Java
- Debug JSP applications
Audience
Anyone who needs to build dynamic web applications using Java and Java EE.
Prerequistes
Prior programming experience in at least one object-oriented language such as a .NET language (e.g., C#, VB.NET), Java, C++, or SmallTalk, or significant programming experience in a modern language such as MS Visual Basic
Course Outline
1. Introducing Java and JavaServer Pages
- Source File Structure
- In which environments does Java run?
- What types of programs is Java used to write?
- Java File Types
- What Servlets Are
- What software do I need in order to run JSP applications?
- What does the J2EE framework include?
- What happens the first time a JSP file is executed?
- Example: Examining a Simple JSP (simpledate.jsp)
- Directives with <%@ %>
- Using <% ... %>, <%! ...%>, and <%= some expression %>
- JSPs: The Inside Out Servlet
- Example: Examining a JSP that Uses Scriptlets (simplefor.jsp)
- Embedding Scriptlets with <% %>
- Java Operators
- Implicit Objects
- Example: Another Way to Embed Scriptlets (simplefor2.jsp)
- Primer on Classes, Objects, and Packages
- Packages
- Importing a Package
- Instantiating an Object or Variable
- Assigning to Primitive Variables
- Separating Variable Declarations and Assignments
- Comments
- <!-- HTML Comment -->
- // Single-line Java Comment
- /* Multi-line Java Comment */
- Lab: Completing a JSP that Generates a Formatted Date
2. The Java Platform
- A Little History
- The Original Java: An Internet Language
- The Java Community Process
- The Java Editions
3. Java: Conditionals
- The if Statement
- Example: Implementing a Conditional (ifdemo.jsp)
- Example: Conditional in JSP (ifdemo2.jsp )
4. JSP: Processing Form Input
- Example: The Request Object (simplegetform.html and simple getresponse.jsp)
- Lab: Processing a Form Submission
- Example: Combining the Form and Processing Code Together
- HTML Primer: Omitting the Action from the <form> Tag
- Java Primer: Testing Strings for Equal Values Using the equals() Method
- Lab: Combining Your Form and Processing Code into a Single File
- Processing Form Inputs with Multiple Parameters
- Example: request.getParameterValues()
- Retrieving All Form Parameters
- Example: request.getParameterNames()
- Lab: Processing Multiple Form Values
5. JSP: Forwards and Includes
- The <jsp:forward> Action
- Example: Automatic JSP Forwarding (simpleForward.jsp)
- Conditional Forwarding
- Example: Conditional Forwarding (ifValidForm.jsp)
- A Preprocessed Include
- Example: Including a Standard Footer (welcomeWithFooter.jsp)
- Dynamic Includes Using <jsp:include>
- Example: Dynamically Including a Header (welcomeWithHeader.jsp)
- Lab: Number Guessing
6. Java: Data, Operators, and Variables
- Variables in Java
- Strong Typing in Java
- Data Types in Java
- Variable Names
- Declaring a Variable
- Value and Reference Types
- Positioning Variable Declarations in Code
- Boolean Data Types
- Numeric Data Types
- Character Data
- Strings
7. JSP: Type Casting Operations on Form Data
- Number Classes vs. Primitive Numeric Types
- Converting from a Numeric Object to a Primitive
- Casting Among Primitive Numeric Types
- Instance Methods vs. Static (Class) Methods
- Instance Method Example
- Static Method Example
- Using the parseXXX() Static Methods to Convert Strings to Primitive Numerics
- Example: Totaling an Order from the User
- Lab: Totaling a User's Order
8. JSP: Exceptions and Basic Form Validation
- Example: Ignoring Bad Numeric Input (add.html)
- Basic Validation using Exception Handling
- Try-Catch-Finally Block
- Exceptions as Objects
- Example: Validating Bad Numeric Input (add2.html)
- A Note on Finally
- Lab: Handling Basic Validation using Exception Handling
9. JSP: Error Trapping
- Page Level: The errorPage and isErrorPage Attributes
- Example: Pagel-Level Error Handling
- Lab: Handling Basic Validation using Error Pages
- Application Level Trapping: web.xml
- Example: Setting Error Pages by Using web.xml
- Lab: Trapping Internal Errors
10. Java: Control Structures
- The Switch Statement
- Statements, Expressions, and Blocks
- Blocks
- Blocks and Variable Scope
- The Tertiary Conditional Operator
- Loops in Java
- while Loops
- do-while Loops
- Arrays
- for Loops with Arrays
- The Structure of a for Loop
- The break Statement
- The continue Statement
- Methods
- Returning from a Method
11. JSP: State Management
12. JSP: Cookies
- Example: Cookies (CookieDemo.jsp)
- Setting a Cookie
- Retrieving a Cookie Value
- Generating Output Based on the Cookie Value
- Comparing Strings
- Clearing Cookies
- Lab: Setting Persistent User Preferences Using Cookies
13. JSP: Session
- Example: Simple Session Values (sessionDemo.jsp)
- Retrieving Session Data
- Integer Objects, int Primitives, and toString()
- Converting Strings to ints
- Setting Session Data with session.setAttribute()
- Retrieving the Session ID
- Clearing the Session Variable
- Lab: Working with the Session Object
14. JSP: Request and Page Attributes
- Example: Request Scope with a Forward
- Lab: Using a Request Attribute in a Header
15. Java: Classes and Inheritance
- Introduction to Object-Oriented Concepts
- Why do we need object-oriented programming?
- Classes are Templates
- Members
- Class Members vs. Object Members
- Objects are Instantiated from Classes
- To Instantiate an Object, Call the Class's Constructor
- Classes Inheritance
- Relevance for Java Server Pages
- Creating Classes and Instances of Them
16. Java: Introducing JavaBeans
- What are JavaBeans?
- What distinguishes JavaBeans from Java Classes?
- Examining our First Bea
Course Labs