FacesContext faces = FacesContext.getCurrentInstance();
HttpServletResponse response = (HttpServletResponse) faces
.getExternalContext().getResponse();
response.setContentType("application/csv");
response.setContentLength(data.length);
response.setHeader("Content-disposition", "inline; filename=\""
+ filename + "\"");
try {
ServletOutputStream out = response.getOutputStream();
out.write(data);
} catch (IOException ex) {
}
faces.responseComplete();
沒有留言:
張貼留言