廣告聯播

2014年12月10日 星期三

Struts 2 加入validate()後,自定義的 action methods 無法運作

From: Polin Wei

Struts 2 支援 POJO 的程式撰寫,所以可以指定 Action Method 來執行您在 struts.xml 中的設定。

action name="userLogout" method="logout" class="com.gu.EipLogin"


加入 validate() 的  this.addFieldError(...) 或 this.addActionError(...) 後,卻發生了錯誤訊息。

原因是 Struts 2 進入 Action 時,會先作 validate() ,沒有錯誤後才會執行後續的 method 如: execute()....等,若有錯誤則返回 ...; 所以當要執行指定的 method : logout() 前,發生了錯誤會返回預設的 ...,但我們又沒有指定,所以才會發生錯誤。
解決的方法是在 logout 的 method 上加入annotation: @SkipValidation ,指示此 method : logout() 不需作 validate() 即可。

2014年12月7日 星期日

Windows Server 2012 R2 的陰影複製設定

From: Polin Wei

陰影複製說明:

  • 存取舊版本資料和救回刪除檔案
  • 可以排程定期追蹤磁碟上的檔案異動
  • 不能用來取代備份
圖一:陰影複製是針對磁碟進行設定,選定目標磁碟

[Win] 陰影複製-1


圖二:按下啟用按鈕

[Win] 陰影複製-2

圖三:陰影複製注意事項,不適合 I / O 負載較高的伺服器

[Win] 陰影複製-3

圖四:啟用後會馬上進行陰影複製,也有 "立即建立" 按鈕,可以手動建立

[Win] 陰影複製-4

圖五:圖二中的設定按鈕,可以指定陰影複製存放位置和最大容量

[Win] 陰影複製-5

圖六:圖五中的排程按鈕,預設排程一天兩次,分別為 0700 am 和 1200 pm

[Win] 陰影複製-6

圖七:啟動陰影複製前,已在 C 磁碟中建立 ShadowDemo 資料夾,資料夾中有檔案 1、檔案 2 兩檔案,為了測試陰影備份,對檔案 1 內容進行修改並刪除檔案 2

[Win] 陰影複製-7

針對檔案 1 可以在內容的 "以前的版本" 看見可用備份

[Win] 陰影複製-8

已刪除的檔案 2,因為沒有檔案存在,可以在資料夾中的 "以前的板本" 中,把檔案 2 救回來,還原會回復整個資料夾,複製可以把整個資料夾還原到指定位置


[Win] 陰影複製-9

檔案 1 和 檔案 2 就救回來啦

[Win] 陰影複製-10

Windows Server 2003/2008/2012 DFS(分散式檔案系統)實作及進階設定參考文件

From: Polin Wei



Windows 2008 R2 DFS(分散式檔案系統)HA架構實作及進階設定(含AD架構)

DFS 複寫:常見問題集 (FAQ)

 


常用指令:
dfsrdiag pollad
Dfsrdiag SyncNow

2014年12月6日 星期六

Windows Server 2012 怎麼改磁碟代號

From: Polin Wei

Windows Server 2012 怎麼改磁碟代號,GUI介面無法修改光碟機磁碟代碼,目前只能用Diskpart來變更磁碟代碼。

DISKPART>list volume            /列出所有volume,注意###號碼
DISKPART>select volume 0     /選擇要改變代號的光碟機,我的光碟機###為0
DISKPART>assign letter=E     /指定資料碟代號為E
DISKPART>exit




2014年11月24日 星期一

Struts 2 整合 Spring 配置實作

From: Polin Wei

Struts 2 要與 Spring 結合並不難,因為 Struts 2 本身就已經預留介面,在 struts2-core-2.x.x.jar 裡的 org.apache.struts2.default.properties 有這一段設定
### if specified, the default object factory can be overridden here
### Note: short-hand notation is supported in some cases, such as "spring"
###       Alternatively, you can provide a com.opensymphony.xwork2.ObjectFactory subclass name here
# struts.objectFactory = spring
 
 實作步驟如下:

Step 01: 建立一個帳號登入的 userLogin.jsp
Step 02: 建立對應的 userLogin Action Class: com.gu.test.spring.LoginAction
 
 Step 03: 利用Maven 來加入 Spring 的 Jar 檔. 可以參考 http://mvnrepository.com/artifact/org.apache.struts/struts2-spring-plugin
 
 Step 04: 配置 Struts & Spring : struts.xml
 
Step 05: 配置 Struts & Spring : applicationContext.xml
 
 Step 06: 配置 Struts & Spring : web.xml
 
登入 http://localhost:8080/guMIS/test/userLogin_input 測試,這樣就可以運作正常了。
 

2014年10月31日 星期五

OAF ( Oracle Application Framework ) Deploy 佈署程序 Oracle EBS R11

From: Polin Wei

環境:
EBS : R11.5.10
JDeveloper: p8751878_GENERIC.zip 解壓至 D:\OAF_R11i
實作:
Step 01: 準備好程式檔案:HelloWorldPG.xml & HelloWorldMainCO.java

Step 02:  Import OA Page to MDS
R11i 的 import.bat 是在目錄 D:\OAF_R11i\jdevbin\jdev\bin 下:
D:\OAF_R11i\jdevbin\jdev\bin\import.bat D:\OAF_R11i\jdevhome\jdev\myprojects\polin\oracle\apps\ak\demo\webui\HelloWorldPG.xml -rootdir D:\OAF_R11i\jdevhome\jdev\myprojects -username apps -password apps -dbconnection "(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=erpdb.polin.com)(PORT=1522))(CONNECT_DATA=(SID=TEST)))"

OAF_R11_Hello_02 

 檢查 MDS 是否有此筆資料
SET serveroutput ON;
BEGIN
  jdr_utils.printdocument('/polin/oracle/apps/ak/demo/webui/HelloWorldPG');
EXCEPTION
WHEN OTHERS THEN
  DBMS_OUTPUT.PUT_LINE(SQLERRM);
END;
 若要刪除此筆 MDS,則可以用 jdr_utils.DeleteDocument 的函數
begin
  jdr_utils.DeleteDocument( '/polin/oracle/apps/ak/demo/webui/HelloWorldPG' ) ;
end ;
/

Step 03: FTP Upload class file to $JAVA_TOP
利用 FTP 工具將開發好所有 Package 的 class files,從開發本機目錄:D:\OAF_R11i\jdevhome\jdev\myclasses\polin\oracle\apps\ak\demo\webui,上載到 EBS 主機上的 $JAVA_TOP 相對應的目錄下,因為撰寫 Java 程式的 Package 為 polin.oracle.apps.ak.demo.webui ,所以 EBS 主機相對應的目錄為 $JAVA_TOP/polin/oracle/apps/ak/demo/webui

Step 04: Configure the Funtions
先規劃 Funtions 的相關屬性再作設定,HTML Call 則是 Step03 中,class file 上載到 EBS 主機上的 $JAVA_TOP 相對應的目錄下,此例為/polin/oracle/apps/ak/demo/webui/HelloWorldPG,所以HTML Call:OA.jsp?page=/polin/oracle/apps/ak/demo/webui/HelloWorldPG

(繼續閱讀...)




2014年10月3日 星期五

JBoss EAP 6.x 對於 Log4j & System.out 在 Eclipse 上 Console 顯示設定

From: Polin Wei

裝完 JBoss EAP 6.x ,並利用 Eclipse 開發程式除錯 Debug 時,發現一般使用 System.out.println() &  logger.info() 都沒有出現在 Console 中,查了好久才找到正解如下:
1. 在 Eclipse 開發環境:
在 Servers 視窗下的 JBoss EAP Server 點兩下,選擇 Open Launch configuration ,然後在 VM arguments 裡最後加入 -Dorg.jboss.as.logging.per-deployment=false 即可

這樣訊息就會出來了,但 System.out.print() 仍會不出現,直到下一個 System.out.println() 才會一起出現,這是JBoss EAP 的 Bug.

(繼續閱讀...)

2014年8月15日 星期五

How to setup EAP6 in Domain Mode with Remote Host Controllers ?

From: Polin Wei

JBoss EAP(Enterprise Application Platform) 提供 Domain Mode ,可以讓應用系統佈署簡單化,也可以讓應用系統不會因一台主機掛了,而導致使用者就無法登入,至於 Domain Mode 的概念在 JBoss EAP 與 JBoss AS/Community edition 及 WildFly 的差異 有提了一下,現在我們來實作。

 Step 01: 設定 Domain Control 主機 Host name: dc-master / ip: 192.168.2.4
修改d:\AppServ\jboss-eap-6.2-master\domain\configuration\host.xml,host name 的值必需是唯一值

Step 02:在 Domain Control 主機 Host name: dc-master / ip: 192.168.2.4 建立 Domain Mode 主機間溝通用專用的帳號 add-user.batdomainMaster,並取得 secret key


接下來的 Step03 & Step04 因為是在同一台主機 Host name: dc-slave / ip: 192.168.3.118 上,所以 management port 要作變動

Step03: 設定 Slave 主機 Host name: dc-slave / ip: 192.168.3.118 上的第一個EAP主機: EAP-instance-two

Step04: 設定 Slave 主機 Host name: dc-slave / ip: 192.168.3.118 上的第二個EAP主機: EAP-instance-three,因為在此 EAP Instance 上有兩個 server:server-threeserver-four 所以要作 port-offset

Step05:啟動 Domain Control 主機 Host name: dc-master / ip: 192.168.2.4
 
d:/>domain.bat -b YourMasterHostName -bmanagement YourMasterHostName
例:
d:/>domain.bat -b dc-master -bmanagement dc-master

Step06:啟動 Slave 主機 Host name: dc-slave / ip: 192.168.3.118 上的兩個EAP主機

Step07:進入管理介面 http://192.168.2.4:9990/console

(繼續閱讀...)

2014年8月14日 星期四

如何在 eclipse 利用 maven 建立 struts2 並在 eclipse internal runtime Server: Tomcat 作開發環境測試

From: Polin Wei


主要目的:如何在 eclipse 利用 maven 建立 struts2 並在 eclipse internal runtime Server: Tomcat 作開發環境測試
平台:
eclipse:
Version: Kepler Service Release 2
Build id: 20140224-0627
maven:Maven Integration for Eclipse (Luna and newer) 1.5
tomcat:apache-tomcat-7.0.52_x64
java:jdk1.7.0_45_x64
jboss:JBoss EAP 6.2.0.GA

step01:建立一個 struts2-archetype-blank 的 maven 專案

可以按一下 Add Archetype,建立一個空的 Struts2 專案,相關欄位資訊可以查:http://struts.apache.org/release/2.2.x/docs/struts-2-blank-archetype.html
 

Step02:轉換成為 Dynamic Web project


選擇此專案 guEBS 按下滑鼠右鍵,選擇 Properties 裡的 Project Facets ,按下 Covert to faceted form...

先將 java 的版本改為 1.7 ,再將 Dynamic Web project 的 check box 打勾,此時下方會出現 "Further configuration available...",Content directory 原本是 WebContent ,修改為 src/main/webapp

再到 Deployment AssemblyMaven Dependencies 加入,然後按 Apply -> ok。
 

Step03:Deploy to Internal runtime Server:Tomcat 測試


執行 Maven build 時, 應該在 target 目前下會產生 guEBS-1.0.0-SNAPSHOT.war,這個檔直接可以佈署在 JBoss 下執行。

 
(繼續閱讀...)

JBoss EAP 與 JBoss AS/Community edition 及 WildFly 的差異

From: Polin Wei

JBoss 是一套應用程式伺服器,屬於開源的企業級Java中介軟體軟體,用於實作基於SOA架構的web應用和服務。目前有分:付費有支援的版本JBoss EAP(Enterprise Application Platform) 及 Red Hat 支援社群的 Community edition 免費版本JBoss AS;與一般社群的 WildFly 版本,軟體下載位置 http://wildfly.org/downloads/

JBoss EAP (Enterprise Application Platform) 是一個支持 Java EE 6 的應用服務器,目前 EAP6 實現了兩個 Java EE 6 的配置文件:Full Profile & Web Profile。在實務作業中有 Standalone & Domain Mode 兩種模式。

(繼續閱讀...)

2014年7月11日 星期五

Apache 利用 mod_rewrite 做到網址轉換達成SEO優化

From: Polin Wei

概念:
Apache Rewirte 主要的功能就是實現URL的跳轉,它的正則運算式是基於Perl 語言。可基於伺服器級的(HTTPd.conf)和目錄級的 (.htaccess)兩種方式。如果要想用到rewrite模組,必須先安裝或載入rewrite模組。
Apache mod_rewrite 規則重寫的標誌一覽

1) R[=code](force redirect) 強制外部重定向:強制在替代字串加上HTTP://thishost[:thisport]/首碼重定向到外部的URL.如果code不指定,將用缺省的302 HTTP狀態碼。

1) R[=code](force redirect) 強制外部重定向:強制在替代字串加上HTTP://thishost[:thisport]/首碼重定向到外部的URL.如果code不指定,將用缺省的302 HTTP狀態碼。

2) F(force URL to be forbidden)禁用URL,返回403HTTP狀態碼。

3) G(force URL to be gone) 強制URL為GONE,返回410HTTP狀態碼。

4) P(force proxy) 強制使用代理轉發。

5) L(last rule) 表明當前規則是最後一條規則,停止分析以後規則的重寫。

6) N(next round) 重新從第一條規則開始運行重寫過程。

7) C(chained with next rule) 與下一條規則關聯:如果規則匹配則正常處理,該標誌無效,如果不匹配,那麼下面所有關聯的規則都跳過。

8) T=MIME-type(force MIME type) 強制MIME類型

9) NS (used only if no internal sub-request) 只用于不是內部子請求

10) NC(no case) 不區分大小寫

11) QSA(query string append) 追加請求字串

12) NE(no URI escaping of output) 不在輸出轉義特殊字元


實作:
首先要讓 Apache 支援 mod_rewrite,可以在 httpd.conf 看有沒有這一行

LoadModule rewrite_module modules/mod_rewrite.so
 

Bootstrap 功能表在滑鼠懸停時自動展開

From: Polin Wei

在網頁上用下面的CSS覆蓋Bootstrap的CSS就行,但是要注意,平板和手機等觸控式螢幕不支持懸停的,最好只覆蓋桌上出版的CSS。

ul.nav li.dropdown:hover ul.dropdown-menu{
display: block;
}
/* if you want to hide the arrow */
a.menu:after, .dropdown-toggle:after {
content: none;
}

原文:http://www.emoticode.net/css/how-to-make-bootstrap-dropdown-menu-expand-on-hover.html
參考:http://stackoverflow.com/questions/8878033/how-to-make-twitter-bootstrap-menu-dropdown-on-hover-rather-than-click

2014年5月27日 星期二

Creating ADF Menus for Page Navigation

From: Polin Wei

Step 1: Create a New Application and Projects
  1. From the main menu, choose File > New. In the New Gallery, expand the General category and select Applications. Then in the Items list, select Fusion Web Application (ADF) and click OK.
    New Gallery, General, Applications

  2. To follow along with the example, enter MenuWebApp as the application name.
    Create Fusion Web application

  3. Accept the defaults and click Finish.

    The Application Overview window opens by default in the editor window area when you create a new application. You can optionally close the window, since you will not be using it to create objects for this application.

    Part of Application Overview window

  4. The new application created from the template appears in the Application Navigator already partitioned into tiered projects, with the associated features set in each project. The Projects panel in the Application Navigator should look like this:

    Application Navigator

    Projects are displayed as the top level in the hierarchy in the Application Navigator. The Fusion Web Application (ADF) template that you used for your web application partitions your application into two projects: Model and ViewController.

    In the Application Navigator you can collapse and expand any panel. You adjust the size of panels by dragging the splitter between two panels. To group and sort items in the Projects panel, use the navigator display options icon Navigator Display Options dropdown menu. For application operations, you can click application icon Application Menu and choose an option from the dropdown menu.

    JDeveloper has the capability of recognizing many different file types, displaying each in its appropriate viewer or editor when you double-click the file in the Application Navigator. Closing an application or project closes all open editors or viewers for files in that application or project and unloads the files from memory.

    Note: Nodes in italics in the Application Navigator mean that the elements have not yet been saved. A project node is bold when a file in the project is selected.
Step 2: Create an Unbounded Task Flow for Each Menu
  1. To be able to follow the steps exactly as written, enter values as shown in the instructions throughout the tutorial. But first, read the information below to learn about the page hierarchy you're going to use in the example.

  2. For example, the illustration below shows a page hierarchy with three levels of nodes under the top-level node, Home. The top-level node represents the root parent page; below the root node are first-level nodes, Products and Shop; below the first-level nodes are second-level nodes, New and Sale and the third-level nodes are Electronics, Media and Office.

    Each node in a page hierarchy corresponds to a page in the application, and each node (except the root Home node) can be a parent and a child node at the same time. For example, the first-level node Products is a parent page that contains general information for the second-level child nodes New and Sale. The second-level node Sale is also a parent node that contains general information for the third-level child nodes Electronics, Media and Office.

    Navigation in a page hierarchy follows the parent-child nodes. For example, to access the Electronics page from the Home page, the end user would first navigate to Products, then to Sale. The path of selected nodes or links starting from Home and ending at Electronics is known as the focus path in the tree.

    3 Menus in page hierarchy

    Some cross-level or cross-parent navigation may also be possible in a page hierarchy. For example, from the Electronics page, end users can jump to the New page on the second level, and to the Products or Shop page on the first level.

    The Help and Preferences nodes, which are on the same level as the root Home node but are not linked to any other node in the hierarchy, are global nodes. Global nodes represent pages that can be accessed from any page in the hierarchy.

    An efficient method of creating a navigation menu system for a page hierarchy is to use a menu model. ADF menus use ADF Controller features in conjunction with the XML menu model to build the navigation menus associated with the page hierarchy.

    In the page hierarchy shown above, a menu consists of a parent node and its child nodes, as indicated by the red outlines on the illustration. So in the tutorial you will create three menus: Home, Products, and Sale. The root or Home menu has two menu items: Products and Shop; the Products menu has two menu items: New and Sale; the Sale menu has three menu items: Electronics, Media, and Office. 
     
  3. In the Application Navigator, right-click the ViewController project and choose New > Web Tier > JSF/Facelets > ADF Task Flow, then click OK.
    New Gallery, Web Tier, JSF/Facelets
  4. In the File Name field, enter adfc-sale-config.xml for the unbounded task flow that represents the Sale menu. Deselect Create as Bounded Task Flow, then click OK.
    Create ADF Task Flow dialog
  5. The source file for an unbounded task flow is written in XML. Each source file must have a unique file name. 

    Use the format adfc-xxx-config.xml for the file name, where xxx is the name of a menu (for example, adfc-sale-config.xml). Using the prefix adfc for all of your source file names for the unbounded task flows helps to identify them as unbounded task flow sources (as opposed to bounded task flow definitions).

    Do not use the file name adfc-config.xml for a menu other than the root or Home menu. adfc-config.xml is the default unbounded task flow automatically created for you by JDeveloper when you created the application using the Fusion Web Application (ADF) template. adfc-config.xml will become the application's root menu that will include the other menus in the application.
  6. In the Application Navigator, right-click the ViewController project again and choose New > Web Tier > JSF/Facelets > ADF Task Flow, then click OK.
  7. In the File Name field, enter adfc-products-config.xml for the unbounded task flow that represents the Products menu. Deselect Create as Bounded Task Flow, then click OK.
  8. In the editor window, click the document tab adfc-sale-config.xml to bring the Sale unbounded task flow diagram forward.
    Task flow diagrammer and Component Palette
  9. In the Component Palette, ADF Task Flow page, Components panel, drag and drop facespage icon View on the diagram, then rename the view activity. Do this four times, using the following view activity names for the pages in the Sale menu:

    sale
    electronics
    office
    media

    Diagrammer, adfc-sale-config.xml

  10. In the editor window, click the document tab adfc-products-config.xml to bring the Products diagram forward.
  11. In the Component Palette, ADF Task Flow page, Components panel, drag and drop facespage icon View on the diagram, then rename the view activity. Do this two times, using the following view activity names for the pages in the Products menu:

    products
    new
    Diagrammer, adfc-products.xml

  12. In the Application Navigator, double-click adfc-config.xml to open it in the diagrammer.
  13. In the Component Palette, ADF Task Flow page, Components panel, drag and drop facespage icon View on the diagram, then rename the view activity. Do this four times, using the following view activity names for the pages:

    home
    help
    preferences
    shop

  14. Click the save all icon Save All to save your work.

    The diagrammer for the default or root adfc-config.xml should look like this:
    Diagrammer, adfc-config.xml
Step 3: Create an ADF Menu for Each Unbounded Task Flow
  1. Starting with the lowest menu in the hierarchy, in the Application Navigator right-click adfc-sale-config.xml and choose Create or Update ADF Menu Model from the context menu.
    Application Navigator, Create ADF Menu context menu option


  2. Enter sale_menu as the menu metadata file name in the File Name field.
    Create ADF Menu Model dialog
  3. Accept the default values and click OK.
  4. In the Application Navigator, right-click adfc-products-config.xml and choose Create or Update ADF Menu Model. Enter products_menu as the menu metadata file name and click OK.

    You should see the structure of products_menu.xml in the Structure window.

    Structure window, products_menu.xml
  5. In the Application Navigator, right-click adfc-config.xml and choose Create or Update ADF Menu Model. Accept the default menu metadata file name (root_menu) and click OK.
  6. The root ADF menu model, which is a representation of the root or Home menu in the page hierarchy written in XML format, looks like this in the Structure window:

    Structure window, root_menu.xml


  7. In the Application Navigator, select the menu metadata file sale_menu.xml.

    The structure of sale_menu.xml should be displayed in the Structure window.

    Structure window, sale_menu.xml
  8. In the Structure window, select each item node and then change the Label attribute value in the Property Inspector. Use the following values for the item labels:

    Sale
    Electronics
    Office
    Media
  9. In the Application Navigator, select products_menu.xml. In the Structure window, select each item node and then change the Label value in the Property Inspector. Use the following values for the item labels:

    Products
    New
  10. In the Application Navigator, select root_menu.xml. In the Structure window, select each item node and then change the Label value in the Property Inspector. Use the following values for the item labels:

    Home
    Help
    Preferences
    Shop
  11. In the Application Navigator, select root_menu.xml again. In the Structure window, select itemNode - itemNode_help.

    Structure window, root_menu.xml
  12. In the Property Inspector, enter http://www.oracle.com in the Destination field and press Enter.
  13. Click the save all icon Save All to save your work.
Step 4: Create a Hierarchy of Parent and Child Nodes in Each ADF Menu
  1. In the Application Navigator, select sale_menu.xml. In the Structure window, using itemNode_sale as the parent node, drag and drop the following item nodes into itemNode_sale, one at a time:

    itemNode_electronics
    itemNode_office
    itemNode_media.
    Structure window, drag and drop child nodes
  2. In the page hierarchy, Sale is identified as a menu node, so itemNode_sale becomes the parent node when grouping child items under a parent in sale_menu.xml.

  3. In the Structure window of sale_menu.xml, right-click the parent node itemNode_sale. Choose Convert to groupNode from the context menu.
    Structure window, Convert To
  4. In an ADF menu metadata file, the root element menu can contain these children

  5. In the groupNode Properties dialog, accept the default id value, which is required. Click browse button at the end of the idref field. Select the first item node, itemNode_electronics.
    GroupNode Properties dialog
  6. A groupNode has a mandatory idref attribute that must reference the id of a child itemNode or another groupNode.
  7. Click OK twice. When prompted, click OK to confirm the conversion.
    Confirm Convert dialog
  8. Unlike the itemNode element, a groupNode element does not have the action and focusViewId attributes.
  9. In the Application Navigator, select products_menu.xml. In the Structure window, using itemNode_products as the parent node, drag and drop itemNode_new into the parent node.

    Structure window, products_menu.xml
  10. In the Structure window of products_menu.xml, right-click the parent node, itemNode - itemNode_products, and choose Insert Inside itemNode > sharedNode.
    Structure window, Insert sharedNode
  11. A shared node is used in an ADF menu to reference a submenu.
  12. In the Insert sharedNode dialog, click the dropdown menu icon dropdown menu and choose Expression Builder.

    Insert sharedNode, Expression Builder dropdown
  13. Expand ADF Managed Beans, then select sale_menu.

    The EL expression #{sale_menu} is populated in the Expression box.
    Expression Builder
  14. You can enter an EL expression directly into the ref field or use the Expression Builder to create one. The EL expression must reference the managed bean name of a submenu.
  15. Click OK twice.
    Structure window, products menu
  16. When you insert a shared node, JDeveloper adds the sharedNode element into the ADF menu metadata source file.
  17. In the Application Navigator, select root_menu.xml. In the Structure window, drag and drop only itemNode_shop into the parent node itemNode_home.

    You do not need to move itemNode_help and itemNode_preferences because they are global nodes on the same level as itemNode_home.

    Structure window, root_menu.xml
  18. In the Structure window, right-click the parent node, itemNode_home, and choose Insert Inside itemNode > sharedNode. In the ref field, enter the EL expression #{products_menu}, which references the managed bean name of the Products menu that is to appear on the home page. Click OK.

    Insert sharedNode dialog
  19. In the Structure window of root_menu.xml, drag sharedNode - #(products_menu} to position it before itemNode_shop.

    Structure window, root menu
  20. Click the save all icon Save All to save your work.
  21. In the editor window for root_menu.xml, you should see the sharedNode element that references the managed bean name for the Products menu: 
Step 5: Create an ADF Page Template
  1. In the Application Navigator, right-click the ViewController project and choose New > Web Tier > JSF/Facelets > ADF Page Template, then click OK.
    New Gallery, Web Tier, JSF/Facelets
  2. If following along with the example, at this point there are no JSF pages in the Application Navigator. 
  3. In the Create ADF Page Template dialog, enter myTemplate.jsf in the File Name field.
  4. Confirm that Facelets is selected as the document type, and Use a Quick Start Layout is not selected.
  5. With the Facet Definitions tab in front, click add green plus icon to add a facetRef. Enter body in the Name field, then click OK.
    Create JSF Page Template dialog
  6. A page template is a template definition file written in XML.
  7. At the top of the editor window, click the document tab myTemplate.jsf to make sure the visual editor is in focus.

    Visual editor of myTemplate.jsf in focus
  8. In the Component Palette, ADF Faces page, Layout panel, drag borderlayout icon Panel Stretch Layout and drop it on the blank page in the visual editor.
  9. In the Layout panel of the palette, from the Interactive Containers and Headers section, drag header icon Panel Header and drop it on the top facet of the panel stretch layout you just added.

    When you drag the component to the facet, you should see a target rectangle with the name Facet top on the page; this means the component you are dragging will be inserted inside that target.

    Visual editor, template page, top facet
  10. In the Property Inspector, Common section, change the Text attribute value to ADF Menu Example, and press Enter.
  11. Click the save all icon Save All to save your work.

    The visual editor should look similar to this:

    Visual editor, initial template page
  12. This is just an example; it is entirely up to you how you want to arrange your template page layout.
Step 6: Add and Bind Navigation Pane Components
You will insert three Navigation Pane components to create three levels of navigation items: one level of global buttons and two levels of tabs.
  1. In the editor window, click the document tab myTemplate.jsf to make sure the template page is in focus. If necessary, click the Design tab at the bottom to use the visual editor.
  2. In the Component Palette, Layout panel, Interactive Containers and Headers section, drag and drop navigationbar icon Navigation Pane into the menuBar facet of the panel header in the visual editor.
    Visual editor, template page, menubar facet
  3. The Navigation Pane component, when bound to an ADF menu model, is used to create the menu navigation items for one level in a page hierarchy.
  4. In the Property Inspector, Common section, choose buttons from the Hint dropdown list.

    Property Inspector, hint dropdown list
  5. Confirm that 0 is in the Level field.
  6. As one Navigation Pane component is used to create the navigation items for one level in a page hierarchy, you must set the level attribute to specify the level to use on each component. 
  7. Expand the Data section. In the Var field, enter menuInfo. Then choose Expression Builder from the property menu icon dropdown menu next to the Value field.

    Property Inspector, Navigation Pane, Data section
  8. Expand ADF Managed Beans and select root_menu. Then click OK.
    Expression Builder, root_menu EL expression
  9. The Navigation Pane component can accept a series of Command Navigation Item components as children, with each Command Navigation Item component representing one menu item. 
  10. In the Structure window, right-click af:navigationPane and choose Facets - Navigation Pane > Node Stamp from the context menu.

    Structure window, template, nodestamp facet
  11. In the Component Palette, Layout panel, Interactive Containers and Headers section, drag and drop navigation icon Navigation Item into the nodeStamp facet.

    Structure window, template, insert into nodestamp
  12. In the Property Inspector of Navigation Item, Common section, enter the following attribute values:
    Attribute Value
    Text #{menuInfo.label}
    Destination #{menuInfo.destination}
    Action #{menuInfo.doAction}


  13. In the Component Palette, Layout panel, drag and drop decorativebox icon Decorative Box into the center facet (of the panel stretch layout) in the visual editor.

    Visual editor, decorative box
  14. In the Component Palette, Layout panel, Interactive Containers and Headers section, drag and drop navigationbar icon Navigation Pane into the top facet of the decorative box you just added.
  15. In the Property Inspector of Navigation Pane, choose or enter the following attribute values:
    Section Attribute Value
    Common Hint tabs
    Level 1
    Data Value #{root_menu}
    Var menuInfo
  16. Repeat steps 7 through 9 to insert a Navigation Item component into the nodeStamp facet of Navigation Pane, and bind the component to the menu model.

    The visual editor looks similar to this after binding the Navigation Item component.
    Visual editor, level 1 navigation item
  17. By binding Navigation Pane to the ADF menu model and using the nodeStamp facet to stamp out command navigation items, practically the same code can be used for Navigation Pane components at any menu level. 
  18. In the Component Palette, Layout panel, drag and drop decorativebox icon Decorative Box into the center facet (of the first decorative box) on the page in the visual editor.

    Visual editor, 2nd decorative box
  19. In the Component Palette, Layout panel, Interactive Containers and Headers section, drag and drop navigationbar icon Navigation Pane into the top facet of the decorative box you just added.
  20. In the Property Inspector, choose or enter the following attribute values:
    Section Attribute Value
    Common Hint tabs
    Level 2
    Data Value #{root_menu}
    Var menuInfo
  21. Repeat steps 7 through 9 to insert a Navigation Item component into the nodeStamp facet of Navigation Pane, and bind the component to the menu model.
  22. Click the save all icon Save All to save your work.

    You have added three Navigation Pane components, one for level 0 buttons, one for level 1 tabs, and one for level 2 tabs. All three components are bound to the same ADF menu model.
    Visual editor, myTemplate page
Step 7: Add and Bind the Bread Crumbs Component
You will insert a Bread Crumbs component to create a path of links from the current page back to the home page.
  1. In the editor window, click the document tab myTemplate.jsf to make sure the template page is in focus. If necessary, click the Design tab at the bottom to use the visual editor.
  2. In the Component Palette, Layout panel, drag and drop decorativebox icon Decorative Box into the center facet on the page in the visual editor.

    Visual editor, center facet
  3. In the Component Palette, General Controls panel, Location section, drag and drop menupath icon Bread Crumbs into the top facet of the decorative box you just added.
  4. The Bread Crumbs component is used to create a path of links from the current page back to the root page.
  5. In the Property Inspector, Data section, enter #{root_menu} in the Value field. Then enter menuInfo in the Var field.

    Property Inspector, Bread Crumbs, Data section
  6. In the Structure window, right-click af:breadcrumbs and choose Facets - Bread Crumbs > Node Stamp from the context menu.
  7. In the Component Palette, Layout panel, Interactive Containers and Headers section, drag and drop navigation icon Navigation Item into the nodeStamp facet.

    Structure window, template page, nodeStamp facet
  8. In the Property Inspector, Common section, enter the following attribute values:
    Attribute Value
    Text #{menuInfo.label}
    Destination #{menuInfo.destination}
    Action #{menuInfo.doAction}
  9. Click the save all icon Save All to save your work.

    The visual editor should look similar to this:

    Visual editor
  10. The complete XML code for the Bread Crumbs component that will generate the appropriate bread crumb links using metadata from the root_menu.xml file 
Step 8: Complete the ADF Page Template
You will insert another Navigation Pane component to create the last level of navigation items.
  1. In the editor window, click the document tab myTemplate.jsf to make sure the template page is in focus. If necessary, click the Design tab at the bottom to use the visual editor.
  2. In the Component Palette, Layout panel, Interactive Containers and Headers section, drag and drop splitpane icon Panel Splitter into the center facet on the page in the visual editor.

    Visual editor, panel splitter
  3. Drag and drop navigationbar icon Navigation Pane into the first facet of the panel splitter you just added.
  4. In this step you insert and bind a fourth Navigation Pane component that will generate level 3 list navigation items in the page hierarchy.
  5. In the Property Inspector, Common section, choose or enter the following attribute values:
    Section Attribute Value
    Common Hint list
    Level 3
    Data Value #{root_menu}
    Var menuInfo
  6. In the Structure window, right-click af:navigationPane and choose Facets - Navigation Pane > Node Stamp from the context menu.
  7. In the Component Palette, Layout panel, Interactive Containers and Headers section, drag and drop navigation icon Navigation Item into the nodeStamp facet.
  8. In the Property Inspector, Common section, enter the following attribute values:
    Attribute Value
    Text #{menuInfo.label}
    Destination #{menuInfo.destination}
    Action #{menuInfo.doAction}
  9. In the Component Palette, Layout panel, Core Structure section, drag and drop facet icon FacetRef into the second facet of the panel splitter on the page.
  10. Choose body from the dropdown list, then click OK.

    Insert Facet Ref dialog

    The body facet, defined in the page template definition, allows page authors to add their own content when they use the page template to create their pages.
    Click the save all icon Save All to save your work.

    The visual editor should look similar to this:
  11. Visual editor
  12. The Navigation Pane code for level 3 is exactly the same as the other levels.
Step 9: Create the JSF Pages for the Views
  1. In the editor window, click the adfc-config.xml tab to bring the unbounded task flow diagram forward. (If not already open, double-click adfc-config.xml in the Application Navigator to open the diagram.)
    Task flow diagrammer, root menu
  2. If following along with the example, at this point there are no JSF pages in the Application Navigator.
  3. On the diagram, double-click a view activity (for example, home) to open the Create JSF Page dialog.
  4. Select Facelets as the document type and accept the default file name (for example, home.jsf).
  5. On the Page Layout page, select Page Template and then select myTemplate from the dropdown list.

    Create JSF Page dialog
  6. Click Managed Bean and select Do Not Automatically Expose UI Components in a Managed Bean.
  7. In the Create JSF Page dialog, you can optionally specify whether or not components on the page are exposed in a managed bean, to allow programmatic manipulation of the UI components. 
  8. Click OK.

    JDeveloper displays the page in the visual editor. The navigation components from the page template should be visible on the page.

    Visual editor, page based on template
  9. In the visual editor, add contents to the page by inserting ADF Faces components into the body facet.
  10. After creating a page based on the template, you can add contents specific to the page you are creating by inserting appropriate ADF Faces components into the body facet. 
  11. Repeat steps 2 through 7 for each remaining view activity on the diagram.
  12. Then repeat the procedure (steps 1 through 8) on the remaining unbounded task flows: adfc-products-config.xml and adfc-sale-config.xml.
  13. Click the save all icon Save All to save your work.
  14. In the editor window, click the adfc-config.xml tab to bring the root unbounded task flow diagram forward.

    Each each unbounded task flow diagram should now look similar to this, where yellow warning symbols no longer appear on the View activity icons.

    Task flow diagrammer
  15. On the diagram, right-click the home view activity icon and choose Run.

    If the Create Default Domain dialog displays, enter the default password, for example weblogic1, in the Password and Confirm Password fields, then click OK.

    The Home page in the browser should look similar to this:
    Home page in browser
  16. By default, JDeveloper automatically configures an integrated server named Integrated WebLogic Server that references a user-specific instance of Oracle WebLogic Server bundled with the IDE.
  17. Click the Products tab, then click New.

    When you click a tab (and any navigation item under it), you should see bread crumb links above the split panes.
    New page in browser
  18. The bread crumbs show the path of links from the current page back to the root or home page. 
  19. Click Sale.

    The application takes you directly to the Electronics page even though you created a Sale page for the Sale view activity.
    Browser page, Sale subtab
  20. This is because the Sale ADF menu (sale_menu.xml) uses a parent groupNode that references the Electronics page through the idref attribute:
  21. Click Help at the top right corner.

    You should see Oracle's web page, not the Help page that you created.
  22. When both the action and destination attributes on an itemNode are specified (as shown in the following root_menu.xml code), destination has precedence over action.
Summary
In this tutorial you created a user interface for navigating an application page hierarchy. You learned how to:
  • Use JDeveloper wizards and dialogs to create applications, task flows, page templates, and starter pages
  • Define unbounded task flows for menus identified in a page hierarchy
  • Use ADF Controller features in conjunction with XML Menu Model to build different levels of menus
  • Bind Navigation Pane and Bread Crumbs components to the ADF menu model
  • Use Integrated WebLogic Server to run a Fusion web application




Ref: http://docs.oracle.com/cd/E18941_01/tutorials/jdtut_11r2_43/jdtut_11r2_43.html