Description
Book SynopsisThe 'Java Servlet and JSP Cookbook' offers clear explanations of how and why the code works, warns of potential pitfalls, and directs you to sources of additional information, so you can learn to adapt the problem-solving techniques to similar situations.
Table of ContentsPreface; 1. Writing Servlets and JSPs; 1.1 Writing a Servlet 1.2 Writing a JSP; 1.3 Compiling a Servlet; 1.4 Packaging Servlets and JSPs; 1.5 Creating the Deployment Descriptor; 2. Deploying Servlets and JSPs 2.1 Deploying an Individual Servlet on Tomcat; 2.2 Using a Context Element in Tomcat's server.xml 2.3 Deploying an Individual Servlet on WebLogic; 2.4 Deploying an Individual JSP on Tomcat; 2.5 Deploying an Individual JSP on WebLogic; 2.6 Deploying a Web Application on Tomcat; 2.7 Deploying a Web Application on WebLogic Using Ant; 2.8 Using the WebLogic Administration Console; 2.9 Using WebLogic Builder to Deploy a Web Application; 2.10 Using the weblogic.Deployer Command-Line Tool; 3. Naming Your Servlets; 3.1 Mapping a Servlet to a Name in web.xml; 3.2 Creating More Than One Mapping to a Servlet 3.3 Creating a JSP-Type URL for a Servlet; 3.4 Mapping Static Content to a Servlet; 3.5 Invoking a Servlet Without a web.xml Mapping; 3.6 Mapping All Requests Within a Web Application to a Servlet; 3.7 Mapping Requests to a Controller and Preserving Servlet Mappings; 3.8 Creating Welcome Files for a Web Application 3.9 Restricting Requests for Certain Servlets; 3.10 Giving Only the Controller Access to Certain Servlets; 4. Using Apache Ant 4.1 Obtaining and Setting Up Ant; 4.2 Using Ant Targets 4.3 Including Tomcat JAR files in the Build File Classpath 4.4 Compiling a Servlet with an Ant Build File; 4.5 Creating a WAR File with Ant; 4.6 Creating a JAR File with Ant; 4.7 Starting a Tomcat Application with Ant; 4.8 Stopping a Tomcat Application with Ant; 5. Altering the Format of JSPs; 5.1 Precompiling a JSP in Tomcat; 5.2 Precompiling a JSP in WebLogic; 5.3 Precompiling JSPs with the Precompilation Protocol; 5.4 Mapping a JSP to Its Page Implementation Class; 5.5 Creating a JSP from Scratch as a JSP Document; 5.6 Generating an XML View from a JSP; 6. Dynamically Including Content in Servlets and JSPs; 6.1 Including a Resource Each Time a Servlet Handles a Request; 6.2 Using an External Configuration to Include a Resource in a Servlet; 6.3 Including Resources Nested at Multiple Levels in a Servlet; 6.4 Including a Resource that Seldom Changes into a JSP; 6.5 Including Content in a JSP Each Time the JSP Handles a Request; 6.6 Using an External Configuration File to Include a Resource in a JSP; 6.7 Including an XML Fragment in a JSP Document; 6.8 Including Content from Outside a Context in a JSP; 7. Handling Web Form Data in Servlets and JSPs 7.1 Handling a POST HTTP Request in a Servlet; 7.2 Handling a POST HTTP Request in a JSP; 7.3 Setting the Properties of a JavaBean in a JSP; 7.4 Setting a Scoped Attribute in a JSP to the Value of a Form Parameter; 7.5 Posting Data from a Servlet; 7.6 Posting Data from a JSP; 7.7 Using a Servlet to Add a Parameter to a Query String 7.8 Using a JSP to Add a Parameter to a Query String; 7.9 Using a Filter to Read Parameter Values; 8. Uploading Files;; 8.1 Preparing the HTML Page for File Uploads; 8.2 Using the com.