如何從java代碼中重定向一個JSF頁面
如何從java代碼中重定向一個JSF頁面
2006-09-10 14:53
如何從java代碼中重定向一個JSF頁面
1 示例代碼如下:
public static void redirectPage(String szPage) |
2. FacesContext fc = FacesContext.getCurrentInstance(); try {
fc.getExternalContext().redirect(this.getRequest().getContextPath()+"/login.faces"); }
catch (IOException e) { e.printStackTrace(); }
The context line should have been declared before the application line of code
FacesContext context = FacesContext.getCurrentInstance(); javax.faces.application.Application app = context.getApplication();