Book Marking is possible only for the Unbounded TaskFlow view activities.For this we need to make the page as bookmarkable. Run time you can identify the view activity as book mark-able by the method ViewBookMarkable().URL parameters can be created to a view activity designated as book markable.URL parameter can be created using EL expressions .There is an option to provide an optional method which will get execute before rendering the view activity.Also there is an option to provide converter to each URL parameter for conversion and validating the input parameters.
Create a bounded task flow
Create a managed bean on PageFlowScope.
Create a bounded task flow
Create a managed bean on PageFlowScope.
package
test.view;
public
class BookMarkable {
private String idTest="Test1";
private String valueTest="Test2";
private String IdConverter;
public void setIdConverter(String IdConverter)
{
System.out.println("setIdConverter");
this.IdConverter = IdConverter;
}
public String getIdConverter() {
System.out.println("getIdConverter");
return IdConverter;
}
public void setIdTest(String idTest) {
this.idTest = idTest;
}
public String getIdTest() {
return idTest;
}
public void setValueTest(String valueTest)
{
this.valueTest = valueTest;
}
public String getValueTest() {
return valueTest;
}
public BookMarkable() {
super();
}
public void
someMethod() {
System.out.println("Som method
executed ....");
}
}
Code for book_view1.jspx
<?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="book_view1.jspx"
id="d1">
<af:form id="f1">
<af:panelGroupLayout
id="pgl1">
<af:outputText
value="#{pageFlowScope.BookMarkable.idTest}" id="ot1"/>
<af:outputText
value="#{pageFlowScope.BookMarkable.valueTest}"
id="ot2"/>
</af:panelGroupLayout>
</af:form>
</af:document>
</f:view>
</jsp:root>
Define the bookmark properties after selecting the view activity from the task flow
Creating the converter
Create a class implementing .adf.controller.UrlParameterConverter
package
test.view;
import
oracle.adf.controller.UrlParameterConverter;
public
class BokMarkURLConverter implements UrlParameterConverter {
public BokMarkURLConverter() {
super();
}
@Override
public Object getAsObject(String string) {
System.out.println("String
="+string);
// TODO Implement this method
return null;
}
@Override
public String getAsString(Object object) {
System.out.println("Object
="+object);
// TODO Implement this method
return null;
}
}
Method getAsObject() and getAsString() is used for validation and conversion. You can create a separate classes for each URL parameters.
Run the page.
Access the page with the url parameters as below and you can see the parameters printed in the screen
No comments:
Post a Comment