|
wl910-ver2.0
Introduction to JavaServer Pages (3 days)
Description
This courseware training guide book will teach you the Java and system design skills necessary to create powerful, database-driven, cross-platform Web applications using JavaServer Pages (JSP).
Suggested Prerequisites• Extensive programming experience using JavaScript, VBScript, Perl, or C++.
• Thorough knowledge of HTML
Next Course
• Integrating JSP and XML
• Intermediate Java 2 Programming
Objectives• Understand the role of Java in Web development
• Learn key object-oriented concepts used by JSP
• Understand different JSP engines
• Learn JSP syntax and structure
• Work with cookies and session management
• Handle form data with JSP
• Integrate JSP with database solutions
• Debug JSP
Course OutlineIntroducing Java and JavaServer Pages • What is Java? • Goals for this course: • In Which Environments does Java Run? • What Types of Programs is Java Used to Write? • Java File Types • Whats are Servlets • Adding Servlet/JSP Functionality to Your Web Server • An Example: Examining a Simple JSP that Uses Directives and Expressions: simpledate.jsp • Directives with [Error processing dynamic tag @ : Missing '=' before method name. Example: [Error processing dynamic tag methodName() : Unknown method methodName()]] • Expressions with [Error processing dynamic tag : Missing left parenthesis '('. Example: [Error processing dynamic tag methodName() : Unknown method methodName()]] • Examining a JSP that Uses Scriptlets: simplefor.jsp • Embedding Scriptlets with [Error processing dynamic tag : Missing '=' before method name. Example: [Error processing dynamic tag methodName() : Unknown method methodName()]] • Java Operators • Implicit Objects • Primer on Classes, Objects, and Packages • Comments • Lab: Completing a JSP that Generates a Formatted Date
Including Content • Include Directive • Lab: Completing a modular JSP that includes a Time Stamp
Conditionals • An example of Implementing a Conditional : ifdemo.jsp • An example of Implementing a Conditional: ifdemo2.jsp
Processing Form Input • The Request Object: simplegetform.html and simple getresp onse.jsp • Lab: Processing a Form Submission • Combining the Form and the Processing Code Together • Lab: Combining your Form and Processing Code into a Single File • Processing Form Inputs With Multiple Parameters • req.getParameterValues() • Retrieving All Form Parameters • req.getParameterNames() • Lab: Processing Multiple Form Values
Type Casting Operations on Form Data • Number Classes versus Primitive Numeric Types • Converting from a Numeric Object to a Primitive • Casting Among Primitive Numeric Types • Instance Methods versus Static (Class) Methods • Using the parse() Static Methods to Convert Strings to Primitive Numerics • Example: Totaling a Parkas Order from the User • Lab: Totaling a User’s Order
Code Level Basic Validation • Basic Validation by Exception Handling • try-catch • finally • Lab: Handling Basic Validation using Exception Handling
Error Trapping • Page Level: The errorPage page directive • isErrorPage Attribute • Lab: Handling Basic Validation using Error Pages • Application Level Trapping: web.xml • Setting Error Pages by Using web.xml • Lab: Trapping 500 Errors
• State Management • Cookies • Cookies Example • Setting a Cookie • Retrieving a Cookie Value • Generating Output Based on the Cookie Value • Clearing Cookies • Lab: Setting Persistent User Preferences Using Cookies
Session Variables • Retrieving the session data: session.getAttribute() • Casting via the () Operator • Converting Strings to integers: Integer.parseInt() • Setting the Sesion data: session.setAttribute() • Retrieving the Session id: session.getId() • Clearing the Session Variables with session.invalidate() • Lab: Working with the Session Object
Reading and Writing Files with java.io • Byte Streams vs. Character Streams • Reading Text Files • Writing Text Files • Example Feedback Log: feedbackform.html and savefeedback.jsp • Retrieving the Real Path with getRealPath() • Exception Handling with try-catch(move out of here, separate, and configure for a separate lab) • Platform-Neutral Newlines with bw.newLine(); • Labs: Saving Orders to a File
Parsing Text Using StringTokenizer • HTML Primer: Tables • Tokenizing Strings: java.lang.StringBuffer and java.util.StringTokenizer • Working with the File object: java.io.File • Serializing the File to a StringBuffer • Converting the StringBuffer to a String and Tokenizing It • Generating the Rows of the Table • Labs: Parsing the Orders Log Using StringTokenizer
Sending Emails from your JSPs • Installing JARs on Your Server • Labs: Implementing the Jakarta TagLibrary mailer application • Generating an Email via the JSMTP Component • Lab: Implementing the JSMTP Component
Processing File Uploads • Example: Processing a File Upload • Configuring the
|
|
|
|