Exception Handler is the central point for handling unexpected
ADF Task Flow provides this facility, using this you can handle all exception that raised in TaskFlow methods.
here i am using ADF bounded TaskFlow with page fragments(.jsff) .
Developers must use this facility to avoid unexpected exception inside taskflows.
This is very simple approach , you have to do nothing more but create a method in Task Flow and mark it as Exception Handler and write your code inside this method , that you want to show when any exception is caught in TaskFlow.
To implement this i have implemented this scenario-
Exception
s that are thrown during the Faces
lifecycle.ADF Task Flow provides this facility, using this you can handle all exception that raised in TaskFlow methods.
here i am using ADF bounded TaskFlow with page fragments(.jsff) .
Developers must use this facility to avoid unexpected exception inside taskflows.
This is very simple approach , you have to do nothing more but create a method in Task Flow and mark it as Exception Handler and write your code inside this method , that you want to show when any exception is caught in TaskFlow.
To implement this i have implemented this scenario-
- Create a method that throw an Exception and add it to taskFlow, and on page call this method on button click
public void exception() {
throw new JboException("Failded to load");
}
throw new JboException("Failded to load");
}
- When we click on button that call exception() method ,JboException is raised inside TaskFlow and look like this- Your page crashed
- Now create a method that will behave as ExceptionHandeler and add it to TaskFlow and mark as Exception Handeler (Symbol in Jdev toolbar for marking)
public void exceptioHandeler() {
System.out.println("Inside Handeler");
FacesMessage message = new FacesMessage("This is custom Message for Jbo Exception-Exception Handeler");
message.setSeverity(FacesMessage.SEVERITY_WARN);
FacesContext fc = FacesContext.getCurrentInstance();
fc.addMessage(null, message);
}
System.out.println("Inside Handeler");
FacesMessage message = new FacesMessage("This is custom Message for Jbo Exception-Exception Handeler");
message.setSeverity(FacesMessage.SEVERITY_WARN);
FacesContext fc = FacesContext.getCurrentInstance();
fc.addMessage(null, message);
}
- Use this sign to mark method as Exception Handeler in bounded Task Flow
- Now Run your page and click on button that call exception() method, your page never crash, as there is handler
nice
ReplyDelete