Special Edition Using Java Server Pages and Servlets
Que Corporation,U.S. (Verlag)
978-0-7897-2441-0 (ISBN)
- Titel ist leider vergriffen;
keine Neuauflage - Artikel merken
Special Edition Using JSP and Servlets starts by detailing the evolution of web servers that led to the creation of ASP and JSP. It explains both the limitations of previous technologies and the benefits that JSP provides including platform independence. Includes coverage of: organizing applications with multiple files and client-side objects, generating well-formed XML using JSP, storing data in cookies and sessions, interacting with Enterprise Java Beans, displaying dynamic graphics with Java 2D, and using RMI and Corba to enhance JSP applications. The final chapters demonstrate advanced JSP & Servlet techniques, including using JSP to create wireless & XML-based applications. Appendices provide an overview of popular JSP & Servlet runtime environments, including Jrun, Tomcat and ServletExec.
Mark Wutka is the president of Wutka Consulting and specializes in helping companies get the most out of Java. He has built numerous Java, JSP and Servlet applications including several online ordering applications. In a past life he was the chief architect on a large, object-oriented distributed system providing automation for the flight operations division of a major airline and for 9 years designed and implemented numerous systems in Java, C, C++, and Smalltalk for that same airline. He previously contributed chapters to Special Edition Using Java 2 Platform and Hacking Java.
Introduction.
Who Should Buy This Book. How This Book Is Organized. Conventions Used in This Book.
I. BASIC JAVA SERVER PAGES.
1. The Evolution of the Web Server.
The Basic Web Server. CGI: The Common Gateway Interface. NSAPI, ISAPI, and Other Loadable Modules. Active Server Pages. Servlets. XML and XSL Stylesheets. Java Server Pages.
2. Getting Started with Java Server Pages.
A “Hello World” Java Server Page. Using the % % Tags in a Java Server Page. Displaying a Value with %=. Inserting Comments. Declaring Methods and Variables with %!. Handling Multiple Threads in a JSP. Troubleshooting.
3. Getting Started with Servlets.
A "Hello World" Servlet.
Compiling the Servlet. Runtime Classpath. The HelloWorldServlet In-Depth.
The Anatomy of a Servlet.
The service Method. The init Method. The destroy Method. The getServletInfo and getServletConfig Methods.
Sending a Response to the Browser. The HttpServlet Class. Choosing Between Java Server Pages and Servlets.
The Advantages and Disadvantages of JSP. The Advantages and Disadvantages of Servlets.
Troubleshooting.
4. Creating HTML Forms.
A Simple HTML Form. Using the request Object.
Handling Multiple Form Values.
Retrieving Form Variables in a Servlet. JavaScript and Java Server Pages.
Passing Data to JavaScript.
Different Ways to Do Forms.
A Practical HTML and JSP Combination. Setting Configuration Parameters. Locking Output Files.
A JSP Input Form Calling a JSP Form Handler. Using the Same JSP for the Input Form and Form Handler.
An Example Input Form and Form Handler JSP.
Troubleshooting.
5. Saving Data Between Requests.
Storing Data in Hidden Form Variables.
Security Concerns with Hidden Variables.
Storing Data in a session Object.
Using the session Object in a JSP. Using the session Object in a Servlet.
How Sessions Work. Forcing a New Session. Handling Session Termination.
The HttpSessionBindingListener Interface.
Handling Sessions Without Cookies.
Disabling Cookies in Internet Explorer. Disabling Cookies in Netscape.
Storing Application-Wide Data.
Why Do You Need the application Object?
Troubleshooting.
6. Debugging and Error Handling.
Why Debugging Is Tough. Using Log Files to Debug an Application.
Using System.out and System.err. Using the Servlet Logging API. Logging to a File. Using Exceptions to Trace Execution.
Using a Debugger.
Debugging a Servlet with Tomcat. Debugging a Java Server Page with Tomcat.
Error Handling.
Specifying an Error Page for a JSP. Specifying Error Handlers for Web Server Errors.
Troubleshooting.
7. Organizing Your Application.
Including Other Files.
Including Files in a JSP at Runtime. Passing Parameters to an Included File. Including Files from a Servlet.
Forwarding to Another Page.
Forwarding to Another Page from a JSP. Forwarding to Another Page from a Servlet. Passing Parameters to the Forwarded Page.
Passing Java Objects Between JSPs and Servlets. Making Your Application More Modular.
A Reusable HTML Table Module.
The Model-View-Controller Paradigm.
How Does Model-View-Controller Help? An Example Controller. An Example View.
Calling Multiple Controllers and Views. Using an Applet in Your Form. Troubleshooting.
8. More About Saving Data.
Designing the Shopping Cart.
Creating the Data Objects. Creating the ShoppingCart Class. Displaying the Contents of the Shopping Cart. Adding and Removing Items. Completing the Order.
Storing Data in a Cookie.
Using Cookies in Servlets and Java Server Pages.
Troubleshooting.
9. Interacting with JavaBeans.
The jsp:useBean Tag.
Adding the Bean to the Page. Getting Bean Properties. Setting Bean Properties. Setting Properties Directly from Parameters. Initializing a New Bean. The Type of an Existing Bean.
A Bean-Based Web Application. Troubleshooting.
10. Performance.
Making Java Server Pages and Servlets Thread-Safe. Buffering Pages to Improve Performance. Caching Objects to Reduce Setup Time. Precompiling Java Server Pages. Simple Java Optimizations.
Use the StringBuffer class. Parsing Numbers. Creating Objects.
Troubleshooting.
II. CORE COMPONENTS IN-DEPTH.
11. JSP and Servlet Lifecycles.
Servlet Lifecycle.
Servlet Loading. Servlet Initialization. Servlet Execution. Servlet Cleanup.
Java Server Page Lifecycle.
JSP Compilation. JSP Loading. JSP Initialization. JSP Execution. JSP Cleanup.
Reloading Other Classes. Troubleshooting.
12. How the Browser Interacts with the Server.
The HTTP Protocol.
Viewing the Request Headers Made by a Browser.
Common Request Headers.
The Accept Header. The Accept-Language Header. The Accept-Charset Header. The User-Agent Header.
Common Response Headers.
The Content-Type Header. The Content-Length Header. The Cache-Control Header.
The HTTP POST Command. GET Versus POST. HTTPS: Secure HTTP. Troubleshooting.
13. Core Servlet Components.
The ServletRequest Class.
Accessing Request Parameters. Accessing Request Attributes. Accessing Protocol-Related Information. Retrieving Request Data. Handling Uploaded Files. Getting Locale Information.
The HttpServletRequest Class.
Getting Header Values. Getting the HTTP Method. Accessing the Query String. Retrieving Cookies. Getting Session Information.
The ServletContext Class.
Getting the Server Version. Initialization Parameters. Saving Application-Wide Objects. Logging Messages. Calling Other Servlets and JSPs. Accessing Application Resources.
The ServletResponse Class.
Setting the Content Type and Length. Opening an Output Stream. Setting Locale-Specific Information. Response Buffering.
The HttpServletResponse Class.
Setting Header Variables. Redirecting the Browser. Returning Status. Encoding URLs. Sending Cookies.
The ServletInputStream Class. The ServletOutputStream Class. The HttpSession Class.
Storing and Retrieving Objects. Controlling Session Termination. Getting Session Status.
The Cookie Class. Creating a New Cookie.
Setting the Domain and Path. Cookie Aging. Secure Cookies. Cookie Protocol Versions. Cookie Comments.
Troubleshooting.
14. Core Java Server Page Components.
The Built-In JSP Objects.
The request Object. The response Object. The out Object. The session Object. The application Object. The pageContext Object. The config Object. The page Object. The exception Object.
The JspWriter Class.
Sending Output Data. Buffer Control. Using a PrintWriter.
The PageContext Class.
Accessing the Built-In Objects. Accessing Attributes from the PageContext Class. Forwarding and Including.
The JspEngineInfo Class. Troubleshooting.
15. JSP Directives.
The page Directive.
The language Option. The import Option. The session Option. The buffer and autoFlush Options. The isThreadSafe Option. The errorPage Option. The isErrorPage Option. The contentType Option. The info Option. The extends Option.
The include Directive.
The taglib Directive. Troubleshooting.
III. JAVA WEB APPLICATION ARCHITECTURE.
16. Introduction to Application Architecture.
The Three Layers of an Application.
Application Tiers. Applications Come Unglued Over Time. Physical Versus Logical Tiers. How Can You Have Half a Tier? What I Mean by “Tier.”
Single-Tiered Applications. Two-Tiered Applications. Three-Tiered Applications. The Trade-Offs.
Application Complexity. Maintainability. Schedule Pressure. Development Team Skill. Miscellaneous Factors.
Hybrid Architectures.
17. Browser-Server Interaction.
Designing Your Web Screens. Redrawing the Entire Page. Organizing the Presentation into Frames. Sending Data to a Hidden Frame.
Sending Data to the Browser. Handling Multiple Calls.
Troubleshooting.
18. A Single-Tiered Web Application.
Storing and Retrieving Data. Locking a File. Storing Data in a Text File. Storing Data with Object Serialization. Storing Data in a Random Access File. Troubleshooting.
19. Building a Two-Tiered Web Application.
Creating a Connection Pool. Mapping Objects to Database Tables.
A Poor-Man's Object-to-Relational Mapping. An Example Data Object.
A Two-Tiered Problem Reporting System.
The Login Screen. The Main Menu. Querying for Existing Problem Reports. Creating and Updating Problem Reports.
Database Locking. Building a Better Connection Pool. Troubleshooting.
20. Designing a Three-Tiered Application.
Stubs and Skeletons. Single-Client Versus Multi-Client Objects.
Scalability. Maintainability. Striking a Balance.
Optimizing Data Access. Database Locking. Three-Tiered Application with Enterprise JavaBeans.
21. Using RMI in a Web Application.
Using a Single RMI Object for All Requests. Using One Object Per Browser Session. An Example RMI Application.
The Database Interface. The Remote Interfaces. Implementing the ServiceRequests Interface. Implementing the RemoteServiceRequest Interface. Creating the Web Interface. Editing Service Requests.
Troubleshooting.
22. Using CORBA in a Web Application.
Using One CORBA Object for All Sessions. Using Separate CORBA Objects for Each Session.
Using CORBA Structs. Dealing with Null Strings. Alternatives to Null.
An Example CORBA Application. Troubleshooting.
23. Using Enterprise JavaBeans in a Web Application.
What Is Enterprise JavaBeans?
Entity and Session Beans. Containers. Persistence. Transactions. Connection Pooling. Object Pooling.
How EJB, Servlets, and Java Server Pages Fit Together. Creating an Entity Bean.
Creating the Entity Bean Implementation. Creating the Home Interface. Creating the Remote Interface.
Creating a Session Bean. Creating a Stateless Session Bean. Accessing EJBs from Java Server Pages. Packaging a Complete EJB and JSP Application. Troubleshooting.
IV. TAKING JSP AND SERVLETS BEYOND HTML.
24. Creating an XML Application.
A “Hello World” XML Page.
Sending XML from a Java Server Page. Sending XML from a Servlet.
A Few Simple Rules for XML. Why Use XML with JSP and Servlets?
Automatically Generated XML. Parsing XML with SAX and DOM.
Troubleshooting.
25. Adding XSL Stylesheets to Enhance an XML Application.
What Is XSL? A Simple XSL Stylesheet. Navigating an XML Document with XPath. Applying XSL Templates on the Browser. Applying XSL Templates from a Servlet. JSP or Stylesheets? Troubleshooting.
26. Creating a Wireless Web Application.
A Wireless “Hello World” Page.
Viewing the Wireless Hello Page.
A Brief Introduction to WML.
Navigating Between Cards. Creating Input Forms. Processing Form Input.
Detecting Wireless Clients in a JSP or Servlet. A Wireless Score Entry and Reporting System.
Deploying the Scores Application.
Troubleshooting.
27. Creating On-the-Fly Graphics.
Images Aren't Just Static Files. Sending Images from a Servlet. Uploading Images to a Servlet from Java. Uploading Images to a Servlet from a Browser. Performing Online Image Processing.
Adding Captions to Images. Embossing Images. Edge Detection. Lighting Effects.
Troubleshooting.
V. ADVANCED TECHNIQUES.
28. Packaging a JSP Application.
A Simple WAR File Example. Installing a WAR File Under Tomcat. Installing a WAR File Under JRun. WAR Configuration Options.
General Application Options. Servlet Options. Others.
Troubleshooting.
29. Extending JSP with New Tags.
A “Hello World” Tag. Packaging and Installing a Tag. Conditional Includes Using Custom Tags. Accessing Tag Attributes. Processing Body Content with a Custom Tag. Adding Scripting Variables. Troubleshooting.
30. Internationalization.
Detecting the Browser's Preferred Locale. Using Locale-Based Text Formatters.
Creating a Locale Object. Formatting Dates. Formatting Currency. Getting a Locale for a Browser's Preferred Language.
Using Resource Bundles in Web Pages. Troubleshooting.
31. Security.
Role-Based Security. Basic Authentication.
The security-constraint Tag. The login-config Tag.
Creating a Custom Login Form. Checking Security Roles Programmatically. Using Client Certificates for Authentication. Troubleshooting.
32. XML Syntax for JSP.
The XML JSP Syntax. The HelloWorld JSP in XML. Translating XML JSP Syntax. Troubleshooting.
Appendix A. JSP Syntax and API Reference.
JSP Syntax.
Code Scriptlets. Expressions. Declarations. Comments. Directives. Built-In Objects. Actions. XML Syntax. Root Document. Code Scriptlets. Expressions. Declarations. Directives. Tag Libraries.
Java Server Pages API.
javax.servlet.jsp. javax.servlet.jsp.tagext.
Appendix B. Servlet API Reference.
The javax.servlet API.
Interfaces. Classes. Exception.
The javax.servlet.http API.
Interfaces. Classes.
Appendix C. Apache and Tomcat.
Where to Get Tomcat. Installing Tomcat.
Installing Tomcat on Windows. Installing Tomcat on Linux or UNIX.
Running Tomcat Standalone. Running Tomcat Under Netscape Server for Windows. Running Tomcat Under IIS. Running Tomcat Under Apache.
Running Tomcat with Apache for Windows. Running Tomcat with Apache for Linux.
Tomcat Configuration. Working Directory. Logging. Setting the Classpath. Authentication. Special Tomcat Features.
WAR File Installation. JSP Compiler.
Appendix D. Jrun.
Where to Find JRun. Installing JRun for Windows. Installing JRun for Linux. Starting JRun. JRun Administration. Connecting JRun to Other Web Servers.
Connecting JRun to IIS or PWS. Connecting JRun to Netscape Web Server. Connecting JRun to Apache.
Using JRun as a Standalone Web Server. Working Directory. Installing Web Applications. Setting the Classpath. Log Files. JRun Special Features.
Appendix E. ServletExec.
Where to Get ServletExec. Installing the ServletExec ISAPI Plug-In. Installing the ServletExec NSAPI Plug-In. Installing the ServletExec Standalone Server for Windows. Installing the ServletExec Standalone Server for Linux/UNIX. ServletExec Administration. Working Directory. Installing Web Applications. Log Messages. Setting the Classpath. ServletExec Special Features.
Appendix F. Resin.
Where to Get Resin. Installing Resin on Windows.
Unpacking Resin with WinZip. Unpacking Resin from the Command Line. Testing the Installation.
Installing Resin on Linux/UNIX. Running Resin Standalone. Running Resin Under Another Web Server. Running httpd or srun as Windows NT Services. Resin Administration. Working Directory. Installing Web Applications. Logging. Setting the Classpath. Adding Authentication Users. Resin Special Features.
JavaScript Java Server Pages. XSL.
Index.
Erscheint lt. Verlag | 18.10.2000 |
---|---|
Sprache | englisch |
Maße | 186 x 230 mm |
Gewicht | 1361 g |
Themenwelt | Informatik ► Programmiersprachen / -werkzeuge ► Java |
Mathematik / Informatik ► Informatik ► Web / Internet | |
ISBN-10 | 0-7897-2441-3 / 0789724413 |
ISBN-13 | 978-0-7897-2441-0 / 9780789724410 |
Zustand | Neuware |
Haben Sie eine Frage zum Produkt? |
aus dem Bereich