import java.net.InetAddress;
String sHostAddr = InetAddress.getLocalHost().getHostAddress();
int sevPort = getRequest().getServerPort();
//getRequest()返回HttpServletRequest
String servletPath = getRequest().getServletPath();
String contextPath = getRequest().getContextPath();
sPath =
"http://" + sHostAddr + ":" + sevPort + contextPath + servletPath + "/";
FacesContext.getCurrentInstance().getExternalContext().redirect(sPath + + loginResult);
/*如:http://127.0.0.1:8988/SRDemoADFBC/faces/app/SRMain.jspx?_afPfm=1
其中 contextPath :/SRDemoADFBC ; servletPath: /faces */