package niit.util;
import javax.faces.context.FacesContext;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class FacesUtil {
/**
* //JSF获取response方法
* @return
*/
public static HttpServletResponse getResponse() {
FacesContext facesContext = FacesContext.getCurrentInstance();
facesContext.responseComplete();
HttpServletResponse response = (HttpServletResponse) facesContext.getExternalContext().getResponse();
facesContext.responseComplete();
return response;
}
/**
* JSF获取request方法
* @return
*/
public static HttpServletRequest getRequest() {
FacesContext facesContext = FacesContext.getCurrentInstance();
facesContext.responseComplete();
HttpServletRequest request = (HttpServletRequest) facesContext.getExternalContext().getRequest();
facesContext.responseComplete();
return request;
}
}