一、摘要
在本教程中,您將使用甲骨文的JDeveloper 11 g版本11.1.2.0.0來構建一個web應用程序。
建立數據模型,您可以使用EJB圖,EJB 3.0和Java Persistence API(JPA)。
web客戶端使用JavaServer Faces(JSF)。
創建一個主從複合結構主頁查詢和編輯功能的用戶界面。
一個任務流,搜索功能,也作爲一個地區添加到頁面中。
Building a Web Application Using EJB, JPA, and JavaServer Faces
Part 1: Building the Data Model with EJB 3.0 Using the EJB Diagrammer
Step 1: Create a New Application and Projects
Step 2: Create the Persistence Model
Step 3: Create an EJB Diagram and a Session Bean
Step 4: Create a Facade Bean to Expose for the Client Application
Step 5: Create ADF Data Controls from EJB Session Beansclose
Part 2: Building the View Projectclose
Step 1: Create a Master-Detail JavaServer Faces Page
Step 2: Bind Data Control Components to the Page
Step 3: Run and Test the Page
Step 4: Add Create and Delete Functionalities to the Page
Part 3: Adding and Exposing a New Method to the UIclose
Step 1: Add a New Method to the Entity and Expose it
Step 2: Build a Bounded Task Flow with Two JSF Pages
Step 3: Use the Task Flow as aRegion in the mainHR page
Step 4: Run the mainHR Page
Part 4: Testing the Facade Inside and Outside the Java EE Container
Step 1: Add a New Method to the Entity and Expose it
Step 2: Run the Java Service outside Java EE container
二、案例1 - Add a New Method to the Entity and Expose it
Step1. 在Employee.java中添加新的方法
Step2. 並重新闡釋session facade
Step3. 查看新增的方法產生在Data Control
三、案例2 - Build a Bounded Task Flow with Two JSF Pages
Step1.創建一個ADF Task Flows
Step2. 創建View1,用以查詢Region, 創建View2,用以顯示結果頁面
Step3. 創建view1的頁面jsff
Step4. 將View的pageDef.xml拖動進入頁面,產生如下結果
Step5. 修改參數和action
Step6. 在查找按鈕中新增一個action listener
Step7. 定義action listener參數如下
Step8. 創建顯示結果的View2
Step10. 從Data Control中綁定數據進入到View2頁面
Step11. 選擇需顯示的欄位
Step12. 定義傳遞的參數
四、案例3 -Use the Task Flow as aRegion in the mainHR page
Step1. 在主頁面上創建顯示View1和View2結果的頁面
Step2. 將Task Flow拖動進入頁面,顯示爲Region
五、案例4 - Run the mainHR Page
Step1. 測試結果如下
Step2. 顯示結果
Step3. Back之後在源頁面中顯示查詢界面再次