用代码实现页面Action跳转
2010-03-17 14:27
393 查看
概述
在ADF 11g中,Task-Flow作为应用开发的最小颗粒度,在实际的应用中发挥着重要作用。对于不同页面之间的跳转关系,可以在Task-Flow中通过Action进行指定和控制,除使用Common Component直接指定Action进行跳转外,还可以在Backing Bean中用代码实现Task-Flow中定义的页面跳转。本文将介绍如何在Backing Bean中用代码实现页面Action的跳转。
实现
1、创建ADF应用
2、在ViewController项目中创建两个新页面,分别为page1.jspx和page2.jspx,为方便处理,在生成页面的同时分别为两个页面创建backing bean
3、将page1和page2分别拖动到adfc-config.xml中,设置control flow rule由page1到page2,设置后的adfc-config.xml应如图:
4、在page1.jspx中添加commond button,双击该按钮,在backing bean中创建该按钮对应的action方法cb1_action
5、page1对应的backing bean中添加如下方法:
6、修改cb1_action的代码如下:
8、在page2.jspx中添加output text,设置其Value为“This is page2”
7、运行page1.jspx,查看结果
本文转自Oracle Seeker:http://oracleseeker.com/2009/11/09/adf_backing_action_taskflow/
在ADF 11g中,Task-Flow作为应用开发的最小颗粒度,在实际的应用中发挥着重要作用。对于不同页面之间的跳转关系,可以在Task-Flow中通过Action进行指定和控制,除使用Common Component直接指定Action进行跳转外,还可以在Backing Bean中用代码实现Task-Flow中定义的页面跳转。本文将介绍如何在Backing Bean中用代码实现页面Action的跳转。
实现
1、创建ADF应用
2、在ViewController项目中创建两个新页面,分别为page1.jspx和page2.jspx,为方便处理,在生成页面的同时分别为两个页面创建backing bean
3、将page1和page2分别拖动到adfc-config.xml中,设置control flow rule由page1到page2,设置后的adfc-config.xml应如图:
4、在page1.jspx中添加commond button,双击该按钮,在backing bean中创建该按钮对应的action方法cb1_action
5、page1对应的backing bean中添加如下方法:
public void navToOutCome(String outCome) { FacesContext facesContext = FacesContext.getCurrentInstance(); Application application = facesContext.getApplication(); NavigationHandler navigationHandler = application.getNavigationHandler(); ControllerContext controllerContext = ControllerContext.getInstance(); String viewId = controllerContext.getCurrentViewPort().getViewId(); if (viewId != null) { navigationHandler.handleNavigation(facesContext, viewId, outCome); } }
6、修改cb1_action的代码如下:
public String cb1_action() { navToOutCome("goPage2"); return null; }
8、在page2.jspx中添加output text,设置其Value为“This is page2”
7、运行page1.jspx,查看结果
本文转自Oracle Seeker:http://oracleseeker.com/2009/11/09/adf_backing_action_taskflow/
相关文章推荐
- PHP实现根据浏览器跳转不同语言页面代码
- js 3秒后跳转页面的实现代码
- js 3秒后跳转页面的实现代码
- 用meta实现的页面跳转代码
- 重写 ajax 实现 session 超时跳转到登录页面实例代码
- php编写的简单页面跳转功能实现代码
- iOS项目开发实战——使用代码实现页面跳转
- php编写的简单页面跳转功能实现代码
- PHP登陆后跳转到登陆前页面实现思路及代码
- 基于jquery的从一个页面跳转到另一个页面的指定位置的实现代码
- Swift - 纯代码实现页面segue跳转,以及参数传递
- JS实现页面内跳转的简单代码
- js 跳转Action页面代码
- js代码中实现页面跳转
- PHP用户登录后跳转回上一访问页面的实现思路及代码
- js 3秒后跳转页面的实现代码
- PHP登陆后跳转到登陆前页面实现思路及代码
- Swift - 纯代码实现页面segue跳转,以及参数传递
- Swift - 纯代码实现页面segue跳转,以及参数传递