SKIP THE SHIPPING
Use code NOSHIP during checkout to save 40% on eligible eBooks, now through January 5. Shop now.
Register your product to gain access to bonus material or receive a coupon.
Sams Teach Yourself JavaServer Pages in 21 Days offers a proven tutorial format to teach JSP in 21 example-driven lessons. This book is for Web publishing professionals migrating to JavaServer Pages for its ability to create dynamic, interactive Web sites and separate presentation from Java code running behind the scenes. The book starts by explaining the relationship between JSP and Java Servlets and the basics of JSP functions and features. You'll then learn how JSP handles data, interacts with Java components, tracks users, and more. Later chapters discuss debugging, working with databases, XSLT and XML, using the Struts framework from Apache, handling binary data like graphics, and deploying JSP applications. Each topic is illustrated with many working examples that the reader can understand and put to work immediately. Throughout the book the author provides pointers to upcoming developments in JSP 2, to ensure that you are prepared for changes in the new version.
Branching, Looping, and Creating Methods
Branching, Looping, and Creating Methods in JSP
Tracking Users with Sessions and Cookies
(NOTE: Each chapter concludes with a Summary, Q&A, and Workshop.)
Introduction.
WEEK 1. AT A GLANCE.
Day 1. Getting Started!What Are JavaServer Pages Good For? It All Starts with Java. The Tomcat Server. Creating Web Documents. A Brief History of JSP. Dissecting Our First JSP. Overview of JSP Syntax. Online JSP Resources.
Day 2. Handling Data and Operators.Java in JSP. The JSP Programming Environment. Handling Data in JSP. Creating Variables. Initializing Variables. Data Types. Converting Between Data Types. Strings. Creating Strings. Strings Are Objects. Determining String Length. Creating and Working with Arrays. Working with Operators. Assignment Operators. Incrementing and Decrementing Operators. Multiplication and Division Operators. Addition and Subtraction Operators. Relational Operators. Logical Operators. Understanding Operator Precedence.
Day 3. Branching, Looping, and Creating Methods.Branching Statements. Loops. Creating Methods.
Day 4. Reading Data from Web Pages: Buttons and Text Fields.HTML Controls. HTML Forms. Submitting Forms. Sending Data to the Server. Using request Objects. Reading Data on the Server. Using Text Fields. Using Text Areas. Using Password Controls. Using Hidden Controls. Using Buttons. JSP to JSP—Navigating Directly to JSP Pages. Using Multiple Forms.
Day 5. Reading Data from Web Pages: Check Boxes, Radio Buttons, and Select Controls.Using Check Boxes. Using Radio Buttons. Selecting and Deselecting Check Boxes and Radio Buttons in Code. Using Select Controls. Using Multiple-Selection Select Controls. Check Box Groups. Uploading Files. Image Controls. Using <jsp:forward>. Creating Image Maps. Using Named Targets. Getting All Parameter Names. Getting Request Header Information. Reset Buttons.
Day 6. Creating JSP Components: JavaBeans.Creating a Java Class. Creating a Constructor. Creating a Method. Compiling a Java Class. Installing a Compiled Java Class. Using a Compiled Java Class. Creating a Package. Using a Package. Passing Data to a Constructor. Using <jsp:useBean>. Creating a Read-Only Property. <jsp:getProperty>: Getting a Property Value. Creating a Read/Write Property. <jsp:setProperty>: Setting Property Values. Creating Private Methods. Java Utility Classes: Working with Dates.
Day 7. Tracking Users with Sessions and Cookies.Using Hidden Controls. The Cookie Class. The HttpServletResponse Interface. Creating a Cookie. Reading a Cookie. Setting and Reading a Cookie in the Same Page. Using Sessions. Creating a Session. Setting Session Timeouts. Using Applications. Using Sessions, Applications, and JavaBeans.
WEEK 2. AT A GLANCE.
Day 8. Handling Errors.Syntax Errors. Runtime Errors. Exceptions. Using try/catch Blocks. Handling Specific Exception Types. Catching Multiple Exceptions. Nesting try/catch Statements. Throwing Exceptions Yourself. Throwing Exceptions from Methods. Creating a Custom Exception Object. Printing to the Server Console. Using Log Files. Using JSP Error Pages. Using JSP Error Pages: The exception Object. Using JSP Error Pages: request Object Attributes.
Day 9. Using Custom JSP Tags.Tag Libraries. The Request Tag Library. Tag Library Descriptor Files. Creating a Simple Tag.
Day 10. Creating Custom Tags.A Simple Text-Inserting Tag. Creating and Supporting Attributes in Custom Tags. Iterating Tags. Cooperating Tags. Using Scripting Variables.
Day 11. Creating More Powerful JavaBeans.Why Inheritance? Using Inheritance. Using Access Specifiers. Calling Superclass Constructors. Overloading Methods. Overriding Methods. Using Superclass Variables with Subclassed Objects. Using Runtime Polymorphism. Creating Abstract Classes. Using Interfaces for Multiple Inheritance.
Day 12. Creating Servlets.Using <jsp:plugin>. Creating Java Servlets. Using the response Object. Using the request Object. The Life Cycle of a Servlet. Creating Web Applications with Servlets. Using Servlet Configurations and Contexts.
Day 13. Creating More Powerful Servlets.Sessions and Servlet Contexts. Forwarding Requests to Other Web Resources. Including Output from Other Web Resources. Handling Forwards and Includes. JSP Model 1 Architecture. JSP Model 2 Architecture. Supporting User Authentication. Using Cookies in Servlets. Thread Safety.
Day 14. Using Filters.Understanding Filters. Creating a Simple Filter. Filtering JSP Pages. Creating Filter Chains. Using Initialization Parameters. Inserting Text Into the Response. Logging. Using Filters for User Authentication. Restricting Access.
WEEK 3. AT A GLANCE.
Day 15. Handling Files on the Server.Using Tomcat Logging. Using the File Class. Streams, Readers, and Writers. Working with Text Files. Writing Text Files. Reading Text Files. Working with Binary Files. Writing Byte Data to Files. Reading Byte Data from Files. Writing Objects to Files. Reading Objects from Files.
Day 16. Getting Started with Databases.What Are Databases? Java Database Connectivity. JDBC Drivers. Creating Connections. Using Structured Query Language.
Day 17. Working with Databases.Data Lookup. The ResultSet Methods. Navigating in a RecordSet. Setting Cursor Type. Getting Information About a Result Set. Joining Tables. Creating and Filling Tables. Updating Data.
Day 18. Using XML and XSLT in JSP.Handling XML with JSP. Sending XML Data to the Browser. Java and XML. DOM XML Parsing. SAX XML Parsing. Handling XSLT with JSP.
Day 19. Using Struts.Putting Struts to Work. Getting Struts. Creating the View. Creating Custom Tags to Supply Data. Creating the Controller Adapter. Accessing Data in the Results Page. Creating the Model.
Day 20. Creating Images on the Fly and Handling Internet Programming.Creating an Image on the Fly. Drawing in Response to User Actions. Drawing Images. Embedding Images in HTML Documents. Internet Programming—Interacting Directly with Servers. Creating Client/Server Applications.
Day 21. Client-Side Programming and Deploying Your Projects.Working with JavaScript. Creating a '<SCRIPT>' Element. Creating Variables. JavaScript Operators. Branching Statements. JavaScript Loops. JavaScript Functions. Handling Events in JavaScript. Deploying Your Web Applications.
Appendix A. Answers to the Quiz Questions.