Tuesday, December 29, 2009

Programmatically Navigating to another page in adf / jsf

Here is the sample code which can be used to programmatically navigating to another page in jsf or adf

FacesContext fctx = FacesContext.getCurrentInstance();
Application application = fctx.getApplication();
NavigationHandler navHandler = application.getNavigationHandler();
navHandler.handleNavigation(fctx,null, "name of navigation case");

Doing some work before showing Popup in ADF

Here is the way to do any processing before calling popup. First of all create a method in backing bean and assign this to action of "commandButton" or "commandLink". Sample signature for you method is as follows:

public void myMethod()
* Place your processing logic here and then call showPoup method

Signature of showPopup is:

public static void showPopup(String popupId)
FacesContext context = FacesContext.getCurrentInstance();

ExtendedRenderKitService extRenderKitSrvc =
Service.getRenderKitService(context, ExtendedRenderKitService.class);
"AdfPage.PAGE.findComponent('" + popupId + "').show();");

Friday, December 25, 2009

JSF Life cycle Tip # 1

Usually people think that by setting the attribute "immediate" true, bypasses the validation life cycle but this is not true in every case. If you talk about CommandButton and CommandLink, then its true and after "Apply Request Values" phase, request processing cycle shifts to "Render Response" phase thus skipping "Process Validation","Update Model Values", and "Invoke Application". ActionListener and action method associcated with CommandButton / CommandLink is executed in "Apply Request Values".
When we talk about editableValueHolder like InputText, and other controls, setting immediate "true" does not bypass the validation or other phases. Infact it just prioritize the control for validation e.g. if you want to validate one input control first than others, then you can set "immediate" for that control to "true".