2. Using the Tutorial Examples 3. Getting Started with Web Applications Deploying a Packaged Web Module Updating a Packaged Web Module Mapping URLs to Web Components Setting Initialization Parameters Mapping Errors to Error Screens Declaring a Reference to a Resource Declaring a Reference to a Web Service Further Information about Web Applications 5. JavaServer Pages Technology 7. JavaServer Pages Standard Tag Library 10. JavaServer Faces Technology 11. Using JavaServer Faces Technology in JSP Pages 12. Developing with JavaServer Faces Technology 13. Creating Custom UI Components 14. Configuring JavaServer Faces Applications 15. Internationalizing and Localizing Web Applications 16. Building Web Services with JAX-WS 17. Binding between XML Schema and Java Classes 19. SOAP with Attachments API for Java 21. Getting Started with Enterprise Beans 23. A Message-Driven Bean Example 24. Introduction to the Java Persistence API 25. Persistence in the Web Tier 26. Persistence in the EJB Tier 27. The Java Persistence Query Language 28. Introduction to Security in the Java EE Platform 29. Securing Java EE Applications 31. The Java Message Service API 32. Java EE Examples Using the JMS API 36. The Coffee Break Application | Accessing Databases from Web ApplicationsData that is shared between web components and is persistent between invocations ofa web application is usually maintained in a database. To maintain a catalogof books, the Duke’s Bookstore examples described in ChaptersChapter 4, Java Servlet Technology throughChapter 15, Internationalizing and Localizing Web Applications usethe Java DB database included with the Application Server. To access the data in a database, web applications use the newJava Persistence API (seeChapter 24, Introduction to the Java Persistence API). SeeChapter 25, Persistence in the Web Tier to learn how the Duke’s Bookstore applicationsuse this API to access the book data. To run the Duke’s Bookstore applications, you need to first populate the databasewith the book data and create a data source in the ApplicationServer. The rest of this section explains how to perform these tasks. Populating the Example DatabaseWhen you deploy any of the Duke’s Bookstore applications usingant deploy, the database isautomatically populated at the same time. If you want to populate thedatabase separately from the deploy task or are using NetBeans IDE to deploythe application, follow these steps:
When you are runningcreate-tables, don’t worry if you see a message thatan SQL statement failed. This usually happens the first time you run thecommand because it always tries to delete an existing database table first beforeit creates a new one. The first time through, there is no tableyet, of course. Creating a Data Source in the Application ServerADataSource object has a set of properties that identify and describe thereal world data source that it represents. These properties include information such asthe location of the database server, the name of the database, the networkprotocol to use to communicate with the server, and so on. Data sources in the Application Server implement connection pooling. To define the Duke’sBookstore data source, you use the installed Derby connection pool namedDerbyPool. You create the data source using the Application Server Admin Console, following thisprocedure:
Copyright © 2010, Oracle and/or its affiliates. All rights reserved.Legal Notices |