Bookmarkable Pages

时间:2022-09-06 20:18:07
Bookmarkable Pages 

Build a Bookmarkable Edit Page with JDeveloper 11g

Purpose

In this tutorial, you use Oracle JDeveloper 11g to build a web application that allows the bookmarking of URL. Based on a predefined application, you implement a functionality that enables to bookmark an edit page from a Browse / Edit type
of application. The data model uses Business Components. For the web client, Java Server Faces (JSF) is used. A browse page and an edit page are included in the user interface.

Time to Complete

20 minutes

Topics

The tutorial covers the following topics:

Bookmarkable Pages Overview
Bookmarkable Pages Scenario
Bookmarkable Pages Prerequisites
Bookmarkable Pages Explore
the Stratup Application
Bookmarkable Pages

Prepare
the Browse Departments Page

Bookmarkable Pages

Make
the Edit Page Bookmarkable

Bookmarkable Pages

Run
the Bookmarkable Page

Bookmarkable Pages Summary

Viewing Screenshots

Bookmarkable Pages Place
the cursor over this icon to load and view all the screenshots for this tutorial. (Caution: This action loads all screenshots simultaneously, so response time may be slow depending on your Internet connection.)

Note: Alternatively, you can place the cursor over an individual icon in the following steps to load and view only the screenshot associated with that step. You can hide an individual screenshot by clicking it.

Overview

The model is provided by business components, while the view and controller are provided by Java Server Faces.

The predefined application includes two pages, a Browse page and an Edit page. The Browse page provides the list of departments and allows you to select a department from the list to edit the department details. The Edit page displays the
department details.

The problem is that when the edit page is displayed for a specific department, the URL in the address is still referencing the entry point of the application (the Browse page). This default behavior stops from being able to bookmark the
Edit page reference.

Back
to Topic List

Scenario

In order to make the Edit page bookmarkable, you add an action listener to the Edit button of the Browse page. In the Edit page, you use a method defined in a managed bean and set the bookmark properties providing
the ability to to bookmark the record information based on the currentRowKeyString value.

Back
to Topic List

Prerequisites

Before starting any section of the tutorial, you should:

Bookmarkable Pages Download
the Required Components and Start JDeveloper 11g
Bookmarkable Pages Upload
the Startup Application
Bookmarkable Pages Create
a Database Connection

Back
to Topic Lis
t

Downloading the Required Components and Start JDeveloper 11g

In the following steps, you download JDeveloper 11g and other files required for this tutorial.

1.

Have access to or have installed Oracle JDeveloper 11g Production. You can download it from Oracle Technology Network.

2.

Have access to or have installed the Oracle Sample Schemas, included with the Oracle 10g or Oracle 11database.

The tutorial uses the HR schema. Specifically, the pages work with the DEPARTMENT and EMPLOYEES tables.

Instructions for installing the HR schema and creating a connection to it in JDeveloper are available online at:

http://www.oracle.com/technology/obe/obe11jdev/11/common/connection11g.htm

3.

Start JDeveloper by selecting Start > All Programs > Oracle WebLogic > JDeveloper Studio 11.1.1.0.0

Bookmarkable Pages

4.

If the Migrate User Settings dialog box opens, click NO.

If prompted for a User Role, choose Default.

Bookmarkable Pages

Close the Tip of the Day window.

5.

The JDeveloper IDE should now be displayed.

Bookmarkable Pages

Back
to Topic

Back
to Topic Lis
t

Uploading the Starter Application

Before you create any component, you must first open the startup application. To do this, perform the following steps:

1.

Download the URL_Bookmark.zip file. Right click the following link and chooseSave Target As... from context to
download the URL_Bookmark.zip file on a local directory of your choice.

2.

Unzip the URL_Bookmark.zip file on a local directory of your choice (i.e. temp)

3.

From the Application Navigator, click the Open Application link.

Bookmarkable Pages

Locate the workspace c:\temp\TaskFlowHandsOn\TaskFlowHandsOn.jws.

Bookmarkable Pages

Click Open. If you are prompted to migrate the project, click Yes to confirm.

4.

The Application is loaded up in JDeveloper.

Bookmarkable Pages

Back
to Topic

Back
to Topic Lis
t

Creating a Database Connection

You need to create a Database Connection to the HR schema. To do this, perform the following steps:

1.

From the Menu Bar, select View | Database Navigator.

Bookmarkable Pages

2.

In the Database Navigator, right click TaskFlowHandsOn and select New Connection from context.

Bookmarkable Pages

3.

In the Create Database Connection, enter the following values:

Connection Name HRConn
UserName hr
Password hr
Deploy Password checked
Driver thin
Host Name localhost
JDBC Port 1521
SID or Service Name ORCL/XE

Bookmarkable Pages

4.

Click the Test Connection button.

Bookmarkable Pages

If the database is available and the connection details are correct, you seeSuccess! in the Status window then click OK.

If an error occurs, verify the settings, make any changes necessary, and then retest the connection. If you still cannot connect, there may be a problem with the database, or it may not be running.

5.

In the Application Navigator, expand the Connections and Database nodes in the Application Resources panel to see the HR connection you just created. You can expand the HRConn node to view the database objects.

Bookmarkable Pages

Back
to Topic

Back
to Topic Lis
t

Exploring the Startup Application

The startup application uses Departments and Employees entity objects and their corresponding view objects.

1.

Open the Application Navigator and expand the Model project nodes. Notice the existing Entities, Views, Links objects and the AppModule.

Bookmarkable Pages

The model project contains all the necessary components needed for the application.

2.

Prior to test the module in the Business Component tester, right click the AppModulenode and select Configurations from context.

Bookmarkable Pages

3.

In the Manage Configurations dialog, select the AppModuleLocal and click Edit.

Bookmarkable Pages

4.

In the Edit Business Components Configuration dialog, for the AppModuleLocal, select the Connection Type to JDBC URL and the Connection Name to HRConn.

Bookmarkable Pages

Click OK, then OK again.

5.

in the Application Navigator, right-click AppModule and choose Run.

Bookmarkable Pages

6.

In the Business Component Configuration dialog, click Connect.

Bookmarkable Pages

Wait for the Browser window to open.

7.

In the Oracle Business Component Browser, double-click DepartmentsView1.

Bookmarkable Pages

8.

Use the navigation buttons to browse through the Departments.

Bookmarkable Pages

9.

Close the Business Component Browser window.

10.

Expand the ViewController project nodes. Double click Web Content | Page Flows | adfc-config node to open the page flow diagram.

Bookmarkable Pages

11.

The page flow display, showing two pages. A BrowseDepartments page and anEditDepartment page.

Bookmarkable Pages

12.

Right click the BrowseDepartments page and select Run from context.

Bookmarkable Pages

13.

In the Set Run Configuration dialog, click OK to accept Default.

Bookmarkable Pages

14.

Examine the URL displayed in the Browser.

Bookmarkable Pages

15.

Select any department from the list and click the Edit Departments button.

Bookmarkable Pages

16.

The corresponding department detail info are displayed.

Bookmarkable Pages

Notice that the URL in the address field of your browser is the same as the BrowseDepartments page one, stopping you from being able to bookmark this specific department details page:

Bookmarkable Pages

17. Close you browser window. In the following sections, you see how to have the edit page keep track of the selected department.

Back
to Topic List

Preparing the BrowseDepartments Page

To be able to provide bookmarkable information about the selected department in the browse page, you add an action listener that holds the referenced department based on the currentRowKeyString property.
To do this, perform the following steps:

1.

Back into JDeveloper within the page flow, double click theBrowseDepartments icon to open the page.

Bookmarkable Pages

2.

The BrowseDepartments page opens in the editor.

Bookmarkable Pages

3.

Select the Edit Departments button to display its properties.

Bookmarkable Pages

4.

The Property Inspector shows an Action mapped to the edit control flow. We need to create an action listener to the Edit Departments button.

Bookmarkable Pages

5.

Select the Set Action Listener from the ADF Faces Operations and drop it onto the Edit Departments button.

Bookmarkable Pages Bookmarkable Pages

6.

In the Insert Set Action Listener dialog, next to the From field, selectExpression Builder from the down arrow.

Bookmarkable Pages

7.

In the Expression Builder dialog, expand ADF Bindings | bindings | DepartmentView1Iterator and select currentRowKeyString.

Bookmarkable Pages

Click OK.

8. Back to the dialog, type the following in the To field: #{pageFlowScope.rowKey}.

Bookmarkable Pages

Select the content of the To field and copy it (Ctrl + C) to the clipboard (we will need it later on).

Click OK.

9.

The properties for the Set Action Listener should look like this:

Bookmarkable Pages

Back
to Topic List

Making the Edit Page Bookmarkable

Pages have bookmark properties allowing you to propagate into the URL of the linked page the reference of the current row. For this purpose we use a managed bean holding the current row value. To do this, perform the following steps:

1.

Open the Diagram view of the page flow and select the EditDepartment page to view the page properties.

Bookmarkable Pages

2.

In the Property Inspector, select the Bookmark tab and set the bookmark property to true and click the Add button Bookmarkable Pages to
create a bookmark URL parameter.

Bookmarkable Pages

3.

For the bookmark URL parameter type rowKey as the name and paste the content of the clipboard in the value field: #{pageFlowScope.rowKey}.

Bookmarkable Pages

4.

Next to the method field, click the down arrow and select the Expression Builder option.

Bookmarkable Pages

5.

In the Expression Builder dialog, expand ADF Managed Beans | pageFlowScope | BookmarkHandler nodes and select handleBookMarkRequest.

Bookmarkable Pages

Click OK.

6.

To review the content of the managed bean that was created in the predefined application, in the Application Navigator, double click the BookmarkHandler.java to open the java class.

Bookmarkable Pages

7.

The handleBookMarkRequest method displays in the editor.

Bookmarkable Pages

8.

Click the EditDepartment.jspx tab to open the page in the editor.

Bookmarkable Pages

9.

Right click in the EditDepartment page and select Go to Page Definition from context.

Bookmarkable Pages

10.

Click the EditDepartment.jspx tab to open the page in the editor.

Bookmarkable Pages

11.

Using the Structure pane for the page definition, right click the bindings node and from context select Insert inside bindings --> Generic Bindings --> action.

Bookmarkable Pages

12.

In the Create Action Bindings dialog, in the Select an Iterator field selectDepartmentsView1Iterator and in the Operation choose setCurrentRowWithKey.

Bookmarkable Pages

In the Parameters section, paste the content of the clipboard in the value field #{pageFlowScope.rowKey}.

Bookmarkable Pages

Click OK.

13.

Now, the page definition should look like this:

Bookmarkable Pages

and the Structure window...

Bookmarkable Pages

14.

Click the save all Bookmarkable Pages icon
to save the application.

Back
to Topic List

Running the Application and Bookmarking the Edit Page

You now use JDeveloper's JSF Navigation Modeler to diagrammatically plan and create your application's pages, and the navigation between them.

1.

Open the page flow diagram by clicking the adfc-config.xml tab.

Bookmarkable Pages

2.

Right click the BrowseDepartments page and select Run from context.

Bookmarkable Pages

3.

The page loads up in your browser. Notice the URL in the address bar.

Bookmarkable Pages

4.

Select a department from the list and click the Edit Departments button.

Bookmarkable Pages

5.

The corresponding department details display.

Bookmarkable Pages

Notice the URL now displayed in the address bar.

Bookmarkable Pages

6.

Using your browser menu bar, bookmark the page.

Bookmarkable Pages

Select a location folder for your bookmark.

Bookmarkable Pages

Close your browser.

7.

Open a new browser window, and select the bookmark you just saved.

Bookmarkable Pages

8.

The browser returns the page corresponding to the department number you bookmarked.

Bookmarkable Pages

11. You can close your browser window.

Back
to Topic List

Summary

In this tutorial, you learned how to:

Bookmarkable Pages Prepare the Browse Department Page
Bookmarkable Pages Make the Edit Page Bookmarkable
Bookmarkable Pages Test the Bookmark Functionality

Back
to Topic List

Bookmarkable Pages Place
the cursor over this icon to hide all screenshots.

Bookmarkable Pages

Bookmarkable Pages的更多相关文章

  1. 用Github pages搭建自己制作的网页,方法最简单,适用于新手

    本文固定链接http://blog.csdn.net/pspgbhu/article/details/51205264 本人自学前端一个多月,写个几个网页想要用来应聘,网上搜各种搭建网站的方法,发现不 ...

  2. Github pages + jekyll 博客快速搭建

    Github pages + jekyll 博客快速搭建 寻找喜欢的模版 https://github.com/jekyll/jekyll/wiki/sites http://jekyllthemes ...

  3. Github Pages和Hexo创建静态博客网站

    Github Pages和Hexo创建静态博客网站 安装Node.js 本人是window环境,所以下载window版. 下载地址:https://nodejs.org/en/download/ 下载 ...

  4. 如何在ASP.NET Web站点中统一页面布局[Creating a Consistent Layout in ASP.NET Web Pages(Razor) Sites]

    如何在ASP.NET Web站点中统一页面布局[Creating a Consistent Layout in ASP.NET Web Pages(Razor) Sites] 一.布局页面介绍[Abo ...

  5. 利用github pages创建简单的网站

    github.com 作为最流行的源代码管理工具已经风靡全球,同时在依托于github也衍生出了各种各样的应用,比如可以利用github搭建博客系统等等. 先换个话题,我们每人手头都或多或少有些&qu ...

  6. 使用ASP.NET Web API Help Pages 创建在线接口文档

    操作步骤 1.新建Web API项目 2.在项目Areas文件夹下找到以下文件,取消注释图中代码. 3.右键解决方案,属性,如图设置. 4.运行程序,点击右上角API 接口列表: 详情-无参数: 详情 ...

  7. 用GitHub Pages搭了个静态博客

    经过周末两天折腾,终于在GitHub Pages上用Hugo搭了个静态博客. 链接:https://xusiwei.github.io/ @ruanyf 曾经在博客里提到过"喜欢写Blog的 ...

  8. 【一】Ubuntu14.04+Jekyll+Github Pages搭建静态博客

    本系列有五篇:分别是 [一]Ubuntu14.04+Jekyll+Github Pages搭建静态博客:主要是安装方面 [二]jekyll 的使用 :主要是jekyll的配置 [三]Markdown+ ...

  9. 回发或回调参数无效。在配置中使用 pages enableEventValidation=true 或在页面中使用 %@ Page EnableEventValidation=true % 启用了事件验证

    WebForm中回发或回调参数无效问题的解决 解决 .NET中回发或回调参数无效问题的解 该错误的详细提示信息为: 回发或回调参数无效.在配置中使用 <pages enableEventVali ...

随机推荐

  1. java语言基础02

    一.Java语言基础(常量的概述和使用)(掌握) 1:什么是常量 就是在程序的执行过程中其值不发生改变的量. 2:Java中常量的分类 (1):字面值常量 (2):自定义常量(面向对象部分讲解) 3: ...

  2. FastDfs点滴

    1.centos安装后提示找不到libevent动态库 根据系统是64位版本还是32位版本,若是64位版本则默认回到 /usr/lib64 目录下查找,而对于32位则到 /usr/lib 目录下查找. ...

  3. 删除svn密码方法

    很多时候使用svn,我们需要切换svn账号,但是由于之前的账号已经选择了记住密码,那么我们应该如何删除svn密码来切换新的svn账号呢? 其实很简单,svn账号密码信息保存在电脑某一文件中,我们只要删 ...

  4. sed的选项与命令简要

    第一部分:sed命令选项 sed选项 说明 -n, --quiet, --silent 静默模式,取消将模式空间中的内容自动打印出来. -e script, --expression=script 以 ...

  5. centos 6&period;9安装python 3&period;6

    .下载源码包在官网按照需要下载到本地 wget https://www.python.org/ftp/python/3.6.1/Python-3.6.1.tgz .解压源码包 tar -xvf Pyt ...

  6. org&period;apache&period;ibatis&period;binding&period;BindingException&colon; Type interface XXX is not known to the MapperRegistry&period;

    动态代理因为namespace的地方写错了

  7. MVC View小技巧

    1.在View中添加命名空间引用 1)直接在.cshtml文件中添加 @using MvcMusicStore.Models 2)在Views文件夹的web.config文件中添加,对整个Views文 ...

  8. php中各种http报错的状态码分析

    HTTP会经常遇见错误,本文主要和大家分享php中各种http报错的状态码,希望能帮助到大家. HTTP 错误 400 400 请求出错 由于语法格式有误,服务器无法理解此请求.不作修改,客户程序就无 ...

  9. 第26章 FMC—扩展外部SDRAM

    本章参考资料:<STM32F76xxx参考手册2>.<STM32F7xx规格书>.库帮助文档<STM32F779xx_User_Manual.chm>. 关于SDR ...

  10. 使用maven时报错Dynamic Web Module 3&period;1 requires Java 1&period;7 or newe

    解决方法:        1. 在eclipse 构建 web中关于java版本有三处需要修改统一.            (1)在 Java Build Path的libraries中修改      ...