Create two bounded task flows
Task Flow1 :
dyregion_view1.jsff
Task Flow2 :
Drag and drop the first task flow as Dynamic Region
Create Managed bean for Region Binding as below
Code for the TestBean.java
Create a testDynamicRegion.jspx as below
Task Flow1 :
<?xml
version='1.0' encoding='UTF-8'?>
<jsp:root
xmlns:jsp="http://java.sun.com/JSP/Page" version="2.1"
xmlns:af="http://xmlns.oracle.com/adf/faces/rich">
<af:panelGroupLayout
id="pgl1">
<af:outputText value="Region
1" id="ot1"/>
</af:panelGroupLayout>
</jsp:root>
dynamicRegion_view2.jspx
<?xml
version='1.0' encoding='UTF-8'?>
<jsp:root
xmlns:jsp="http://java.sun.com/JSP/Page" version="2.1"
xmlns:af="http://xmlns.oracle.com/adf/faces/rich">
<af:panelGroupLayout
id="pgl1">
<af:outputText value="Region
2" id="ot1"/>
</af:panelGroupLayout>
</jsp:root>
Drag and drop the first task flow as Dynamic Region
Create Managed bean for Region Binding as below
Code for the TestBean.java
package
view;
import
oracle.adf.controller.TaskFlowId;
public
class TestBean {
private String taskFlowId =
"/WEB-INF/tfDynamicRegion.xml#tfDynamicRegion";
public TestBean() {
System.out.println("taskFlowId=" + taskFlowId);
}
public String test() {
taskFlowId =
"/WEB-INF/tfDyanamicRegion1.xml#tfDyanamicRegion1";
System.out.println("taskFlowId1
=" + taskFlowId);
// Add event code here...
return null;
}
public TaskFlowId getDynamicTaskFlowId() {
return TaskFlowId.parse(taskFlowId);
}
public void setDynamicTaskFlowId(String
taskFlowId) {
this.taskFlowId = taskFlowId;
}
public String test1() {
// Add event code here...
taskFlowId = "/WEB-INF/tfDynamicRegion.xml#tfDynamicRegion";
System.out.println("taskFlowId2=" + taskFlowId);
return null;
}
}
Create a testDynamicRegion.jspx as below
<?xml
version='1.0' encoding='UTF-8'?>
<jsp:root
xmlns:jsp="http://java.sun.com/JSP/Page" version="2.1"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:af="http://xmlns.oracle.com/adf/faces/rich">
<jsp:directive.page
contentType="text/html;charset=UTF-8"/>
<f:view>
<af:document
title="testDynamicRegion.jspx" id="d1">
<af:form id="f1">
<af:panelGroupLayout
id="pgl1">
<af:link text="link
1" id="l1"
action="#{pageFlowScope.TestBean.test1}"/>
<af:link text="link
2" id="l2"
action="#{pageFlowScope.TestBean.test}"/>
</af:panelGroupLayout>
<af:region
value="#{bindings.dynamicRegion1.regionModel}" id="r1"/>
</af:form>
</af:document>
</f:view>
</jsp:root>
Run the pages and click on the pages to see the region dynamically changes.
No comments:
Post a Comment