Oracle Fusion Middleware Developing Web Applications, Servlets, and Jsps for Oracle Weblogic Server, 12C Release 1 (12.1.1) E21049-03
Total Page:16
File Type:pdf, Size:1020Kb
Oracle® Fusion Middleware Developing Web Applications, Servlets, and JSPs for Oracle WebLogic Server 12c Release 1 (12.1.1) E21049-03 August 2014 This document is a resource for software developers who develop Web applications and components such as HTTP servlets and JavaServer Pages (JSPs) for deployment on WebLogic Server. Oracle Fusion Middleware Developing Web Applications, Servlets, and JSPs for Oracle WebLogic Server, 12c Release 1 (12.1.1) E21049-03 Copyright © 2007, 2014, Oracle and/or its affiliates. All rights reserved. This software and related documentation are provided under a license agreement containing restrictions on use and disclosure and are protected by intellectual property laws. Except as expressly permitted in your license agreement or allowed by law, you may not use, copy, reproduce, translate, broadcast, modify, license, transmit, distribute, exhibit, perform, publish, or display any part, in any form, or by any means. Reverse engineering, disassembly, or decompilation of this software, unless required by law for interoperability, is prohibited. The information contained herein is subject to change without notice and is not warranted to be error-free. If you find any errors, please report them to us in writing. If this is software or related documentation that is delivered to the U.S. Government or anyone licensing it on behalf of the U.S. Government, the following notice is applicable: U.S. GOVERNMENT END USERS: Oracle programs, including any operating system, integrated software, any programs installed on the hardware, and/or documentation, delivered to U.S. Government end users are "commercial computer software" pursuant to the applicable Federal Acquisition Regulation and agency-specific supplemental regulations. As such, use, duplication, disclosure, modification, and adaptation of the programs, including any operating system, integrated software, any programs installed on the hardware, and/or documentation, shall be subject to license terms and license restrictions applicable to the programs. No other rights are granted to the U.S. Government. This software or hardware is developed for general use in a variety of information management applications. It is not developed or intended for use in any inherently dangerous applications, including applications that may create a risk of personal injury. If you use this software or hardware in dangerous applications, then you shall be responsible to take all appropriate failsafe, backup, redundancy, and other measures to ensure its safe use. Oracle Corporation and its affiliates disclaim any liability for any damages caused by use of this software or hardware in dangerous applications. Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners. Intel and Intel Xeon are trademarks or registered trademarks of Intel Corporation. All SPARC trademarks are used under license and are trademarks or registered trademarks of SPARC International, Inc. AMD, Opteron, the AMD logo, and the AMD Opteron logo are trademarks or registered trademarks of Advanced Micro Devices. UNIX is a registered trademark of The Open Group. This software or hardware and documentation may provide access to or information on content, products, and services from third parties. Oracle Corporation and its affiliates are not responsible for and expressly disclaim all warranties of any kind with respect to third-party content, products, and services. Oracle Corporation and its affiliates will not be responsible for any loss, costs, or damages incurred due to your access to or use of third-party content, products, or services. Contents Preface ............................................................................................................................................................... xiii Documentation Accessibility................................................................................................................... xiii Conventions ............................................................................................................................................... xiii 1 Introduction and Roadmap 1.1 Document Scope and Audience................................................................................................ 1-1 1.2 Guide To This Document........................................................................................................... 1-1 1.3 Related Documentation.............................................................................................................. 1-3 1.4 Examples for the Web Application Developer ....................................................................... 1-3 1.4.1 Avitek Medical Records Application (MedRec).............................................................. 1-3 1.4.2 Web Application Examples in the WebLogic Server Distribution............................... 1-3 1.5 New and Changed Features In This Release .......................................................................... 1-4 2 Understanding Web Applications, Servlets, and JSPs 2.1 The Web Applications Container ............................................................................................. 2-1 2.1.1 Web Applications and Java EE .......................................................................................... 2-1 2.1.2 Web Application Development Key Points..................................................................... 2-2 2.2 Servlets.......................................................................................................................................... 2-2 2.2.1 Servlets and Java EE ............................................................................................................ 2-3 2.2.2 What You Can Do with Servlets........................................................................................ 2-3 2.2.3 Servlet Development Key Points....................................................................................... 2-4 2.3 JavaServer Pages ......................................................................................................................... 2-4 2.3.1 JSPs and Java EE .................................................................................................................. 2-4 2.3.2 What You Can Do with JSPs .............................................................................................. 2-5 2.3.3 Overview of How JSP Requests Are Handled ................................................................ 2-5 2.4 Web Application Developer Tools ........................................................................................... 2-5 2.4.1 Other Tools ........................................................................................................................... 2-5 2.5 Web Application Security.......................................................................................................... 2-6 2.6 Avoiding Redirection Attacks................................................................................................... 2-6 2.7 P3P Privacy Protocol .................................................................................................................. 2-6 2.8 Displaying Special Characters on Linux Browsers ................................................................ 2-7 3 Creating and Configuring Web Applications 3.1 WebLogic Web Applications and Java EE .............................................................................. 3-1 3.2 Directory Structure ..................................................................................................................... 3-1 iii 3.2.1 Accessing Information in WEB-INF.................................................................................. 3-2 3.2.2 Directory Structure Example ............................................................................................. 3-2 3.3 Main Steps to Create and Configure a Web Application...................................................... 3-3 3.3.1 Step One: Create the Enterprise Application Wrapper.................................................. 3-3 3.3.2 Step Two: Create the Web Application ............................................................................ 3-3 3.3.3 Step Three: Creating the build.xml File............................................................................ 3-4 3.3.4 Step Four: Execute the Split Development Directory Structure Ant Tasks................. 3-4 3.4 Configuring How a Client Accesses a Web Application ...................................................... 3-4 3.5 Configuring Virtual Hosts for Web Applications .................................................................. 3-5 3.5.1 Configuring a Channel-based Virtual Host..................................................................... 3-5 3.5.2 Configuring a Host-based Virtual Host ........................................................................... 3-5 3.6 Targeting Web Applications to Virtual Hosts ........................................................................ 3-5 3.7 Loading Servlets, Context Listeners, and Filters.................................................................... 3-5 3.8 Shared Java EE Web Application Libraries............................................................................. 3-6 4 Creating and Configuring Servlets 4.1 Configuring Servlets..................................................................................................................