25 September, 2012

ADF : Redirect to another View Programatically

You can use the below method to redirect to another view in ADF programatically.
 
    public static void redirectToView(String viewId) {
        FacesContext fCtx = FacesContext.getCurrentInstance();
        ExternalContext eCtx = fCtx.getExternalContext();

        String activityUrl = ControllerContext.getInstance().getGlobalViewActivityURL(viewId);
        try {
            eCtx.redirect(activityUrl);
        } catch (IOException e) {
            e.printStackTrace();
            JSFUtils.addFacesErrorMessage("Exception when redirect to " + viewId);
        }
    }
 

Thanks

3 comments:

  1. Mahmoud, instead it will be better to use ADF taskflow navigation

    public static void navigateTo(String navigationOutcome) {
    FacesContext context = FacesContext.getCurrentInstance();
    Application application = context.getApplication();
    application.getNavigationHandler().handleNavigation(context, null, navigationOutcome);
    }

    ReplyDelete
  2. Thank you both. this works fine. How do I open the page in a new window though?

    ReplyDelete
  3. Hi to open page in new window use dialog framework
    by setting commndbutton property usewindow true.action property dialog:navigationcase

    ReplyDelete

ADF : Scope Variables

Oracle ADF uses many variables and each variable has a scope. There are five scopes in ADF (Application, Request, Session, View and PageFl...