Task Flow Template is used to promote reuse. Any Bounded Task Flow based on template can use the activities, control flows and managed beans that the template contains. It is recommended that all Task Flows are based on Task Flow Templates.
In this post we will promote reuse of an Exception Handler. Exception Handler is a Task Flow component used for handling exceptions that are thrown during the ADF Faces lifecycle.
For this example we will use Page Fragments.
Download the sample application: ExceptionHandlerApp.zip.
Create a Task Flow Template, and name it TaskFlowTemplate.
Drag and drop a Method Call, and change the name to Exception.
Right-click on Exception and select Mark Activity | Exception Handler.
Double-click on Exception and create the TaskFlowTemplateBean.
Double-click on Exception, and implement the method.
Create a new Task Flow based on template. Name it TaskFlow.
Drag and drop a View and a Method Call on the diagram.
Double-click on Page and click on OK.
Drag and drop a button on page and configure it.
Double-click on CallException and create the TaskFlowBean.
Double-click on CallException, and implement the method.
Create a page and insert the TaskFlow as region.
Right-click on page and select Run to test your application.