文档库 最新最全的文档下载
当前位置:文档库 › 创建一个无缝的Web应用方法

创建一个无缝的Web应用方法

创建一个无缝的Web应用方法
创建一个无缝的Web应用方法

创建一个无缝的Web应用方法

准备工作:

1、用脚本来创建数据库,D:\source\erp\FOD_11\Infrastructure下的工程文件,复制JDBC的驱动文件,从\\C:\oraclexe\app\oracle\product\10.2.0\server\jdbc\lib复制ojdbc14和ojdbc14_g 到\\Oracle\Middleware\wlserver_10.3\server\lib

2、在build.properties 中检查jdbc.urlBase=jdbc:oracle:thin:@10.0.11.61

這里改成自己的IP

3、在build.properties 中检查jdeveloper.home=C:/Oracle/Middleware/jdeveloper

第一章、Create Business Components(创建业务组件)

1、Create a New Application(创建一个新的应用)方法如下。

输入application Name,Application Template选择Fsion Web Application(ADF),然后点击Finish。

2、Create a Database Connectio(创建数据库连接)

以上主要用XE数据库,连接名称任意输入,用户名:fod,密码:fusion,连接类型:oracle (JDBC),最后点击“Test Connection”,如出现Success则连通成功。点OK完成。

3、Create Oracle ADF Business Components(创建Oracle ADF 业务组件)

点file new出现下图所示

bussiness Tier→ADF Business Components→点击OK

直接点击OK,出现如下图所示

点Query搜索表,在Available中选择你需要的表到Selected中去。

点Next

点finish

4、编辑视图

5、Add Validation Logi(添加有效的逻辑)

6、测试业务组件逻辑

右击FODModle,点Run connect,然后组件浏览器将会打开,它可以对数据进行操作。第二章、Create a Simple User Interface(创建一个简单的用户接口)

1、Create the Page Flow

File>New>web Tier>JSF>ADF TaskFlow

点击OK,一个page flow页面会生成,在组件面板中把拖两个view组件到该页面中,然后在组件面板中点击control Flow case,对2个view拉两条双向的流程线,线条上分别改名为goEdit和goBrowse,如下图。

2、Create a JSF Page

3、Create a Browse Page

4、Create an Edit Page

5、Create a Create Action

6、Run the Application

第三章、Add a List of Values(添加列表值)

1、Create a Static View Object(创建一个静态的视图对像)

选择工程model然后点击file>New >Business Tier>ADF business Components>view object

输入Name后选择Rows populated at design times(static List静态列表,设计时列举的列表),点Next

点New后进入如下画面

选择key Attribute,点击Ok

2、Create a Static LOV

在编辑窗口,点出editOrders.jslpx ,把OrderStatusCode输入框删除,进入Data Controls 面板,展开FODModuleDataControl OrderView1节点,选择OrderStatusCode属性,把它拖到OrderShippedDate右边,依次点击Create context menu>Single Selections ADF。

3、Create a Lookup View Object

在the Application Navigator,点击Moderl>file>New>Buiness Tier>ADF Business Comments>View object

下图

在Query Statement中输入“SELECT * from PERSONS Persons

WHERE Persons.PERSON_TYPE_CODE = 'CUST'“,然后点击Test ,如果出现"query is

valid"的信息,再点击Next一直到第6步,

一步到第8步

Accessors tab中,点击Add,出现如下图画面

左边选择CustomerView到右边去,然后点ok, 在Orders.xml画面中,选择Attributes页标签,然后选择CustomerId项在attribtes表中,然后在Validaation Rules项中点Add出现下图所示。

在Add Validation Rule dialog对话框中, 从Rule Type列表中挑选“Key Exists”,从Validation Target Type 列表中选择” View Accessor “

在Orders Entity Attributes面板中挑选CustomerId,在Validation Target Attributes面板中选PersonId,点击Add,然后点ok, Click OK to continue without defining an error message.

4、Create a Dynamic LOV

在编辑窗口,打开OrdersView.xml 并选择select the Attributes tab,在attributes table中选择CustomerId attribute., 展开List of Values section.点Add为这个项目增加一个LOV 。

在List of Values dialog对话框中, 从List Data Source下拉列表中选择Orders.CustomerView1 list. 从the List Attribute 下拉列表中选择PersonId , 选UI Hints 页,在Available pane 中选择下列属性到Selected面板中,它们是: PersonId, FirstName, LastName, Email, Gender,然后点OK关闭当前窗口。

在编辑窗口点出editOrders.jspx,选择输入框栏位CustomerId并删除它。

在Data Controls面板中, 展开FODModuleDataControl | OrdersView1节点,选择CustomerId attribute 把它拖到页面的先前位置。

第四章:Add a Search Form(添加一个搜索表单)

1、在编辑窗口打开OrdersView.xml页面并选择Query Tab页,如下图所示。

在the View Criteria部分点击(Add)。

在Create View Criteria dialog对话框, 在Edit Query Criteria 页, 点击Add item按钮。

I在Criteria Item 部分, 从Attribute下拉列表中选择OrderId ,从Operator 下拉列表中.选择Greater than or equal to,在Operand下拉列表中确认是选择的Literal . 在Value栏位中输入1.点击”Test”测试语法的有效性。当出现"query is valid"信息时点击OK.。点击Control Hints tab. 选择Select Query Automatically, 从“Search Region Mode”下拉列表中选择Advanced,点击OK关闭“the Create View Criteria dialog”对话框。

2、Add a Search Form to the Page(添加一个搜索窗口到页面)

在编辑窗口打开browseOrders.jspx tab页,在结构窗口中展开’at form’,在at form中你会看到af:panelFormLayout,在Data Controls panel中展开OrdersView1 节点和Named Criteria 节点,选择OrdersViewCriteria 并把它拖到af:panelFormLayout中并在af:form 结构窗口中,(这个搜索窗口的位置应页面的顶端并且在窗口组件中),依次选择下列菜单Create context menu, choose Query ADF Query Panel。

通过structure看看Query 面板拖的位置是不是form中并在af:panelFormLayout前面,如果在af:panelFormLayout中没有必要有一个query组件就把它放在页的顶端。结关系如下图所示,

在Structuer窗口中,选择af:table组件,在属性检查器上展开Behavion部分,在PartialTriggers 栏位,选择Edit属性打开the Edit Property dialog对话框

在Available panel中依次展开panelgroupLayout> panelHeader。然后选择query* - 到Selected panel,最后点击OK。可以开始运行了。

第五章Add a Graph(添加一个图片)

1、Create a View Object(添加一个视图对象)

选择工程model然后点击file>New >Business Tier>ADF business Components>view object 输入WarehouseStockLevelsView作为对象名. 选择Read-only access through SQL query, 点Next. 在第2步在Query处输入SQL语句,有下列字段: the warehouse id, warehouse name, product id, and quantity on hand. For example如名如下:

SELECT

Warehouses.Warehouse_id,

Warehouses.Warehouse_Name,

WarehouseStockLevels.Product_Id,

WarehouseStockLevels.Quantity_On_Hand

FROM

WAREHOUSES Warehouses,

Warehouse_Stock_Levels WarehouseStockLevels

WHERE

Warehouses.warehouse_id = WarehouseStockLevels.wareho

Click Test to validate the SQL syntax. Click OK when the "query is valid" message displays. Click Next, accepting defaults until you reach step 6 of the wizard, Attribute Settings. For the WarehouseId attribute, select Key Attribute, to use this later for the graph binding in the page. Then click Finish.

2、Add the View Object to the Application Module(添加一个视图链结对象到应用模块)

依次展开节点model.model.FOModel然后点击file>New >Business Tier>ADF business Components>view object

输入OrderItems_WarehouseStockLevels_ViewLink作为对象名,点Next

在Select Source Attribute展开OrderItemsView并选择ProductId,在Select Destination Attribute pane展开WarehouseStockLevelsView并选择ProductId,

点击Add在两者之间建立链接。点击Next 到整个向导结束,通通采用缺省值。然后点击完成。

在Application Navigato r中双击FodModule打开application module definition in the overview editor.选择the Data Model tab.

在Available View Objects pan e中展开OrderItemsView并选择WarehouseStockLevelsView via OrderItems_WarehouseStockLevels_ViewLink.在Data Model pane展开OrdersView1并选OrderItemsView2. 点击Add Instance to add the view object via the view link

3、Add a Graph to the Page(添加一个图表到这个页面)

In the editor window, click the browseOrders.jspx tab to bring the page forward. In the Structure window, make sure the component hierarchy of browseOrders.jspx is shown. In the Data Controls panel, expand the OrdersView1 | OrderItemsView2 nodes. Drag the WarehouseStockLevelsView1 node to the Structure window and drop it on the af:form component. (This ensures the collection is placed on the page below the OrderItems detail table.) From the Create context menu, choose Graphs. From the Create context menu, choose Graphs. In the Component Gallery, select Bar from the Categories list and Bar in the Graph Types section. Then click OK.

In the Create Bar Graph dialog, make sure Include Child Accessors is not selected.

Drag QuantityOnHand from the Available list to the Bars field.

相关文档