---
title: "ADF 转向"
author: "genius"
date: "2011-05-22T15:02:55Z"
tags: []
categories: ["企业架构"]
slug: "adf"
draft: false
lastmod: "2011-05-22T15:05:22Z"
id: 1054411
url: "https://genius.iteye.com/blog/1054411"
---

Sometimes you want to perofrm some validations and based on the result, forward to other ADF pages.

You can follow one of these following approches.

**Approach I**  
/* Forward to page "myPage.jspx" \*/  
FacesContext fc = FacesContext.getCurrentInstance();  
UIViewRoot viewRoot = fc.getApplication().getViewHandler().createView(fc, "/myPage.jspx");  
fc.setViewRoot(viewRoot);  
fc.renderResponse();

**Approach II**  
/* Forward to the navigation rule "mypage" \*/  
FacesContext fc = FacesContext.getCurrentInstance();  
fc.getApplication().getNavigationHandler().handleNavigation(fc, null, "mypage");

**Approach III**  
/* Redirect to page myPage.jspx \*/  
FacesContext.getCurrentInstance().getExternalContext().redirect(/myPage.jspx);

Approach I and II preserve the processScope