Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- StringBuilder htmlRel = new StringBuilder();
- clienteService.gerarRelatorioHistoricoCompra(htmlRel,this);
- htmlRel.append("</body>"+
- "</html>");
- // Obtém uma referencia para o objeto response que esta sendo utilizado
- // pela aplicação.
- HttpServletResponse response = (HttpServletResponse) FacesContext.getCurrentInstance().getExternalContext().getResponse();
- response.setContentType("application/html");
- // Configura informações sobre o arquivo no response
- response.setHeader("Content-disposition","attachment;filename=cliente.html");
- byte[] theByteArray = (htmlRel.toString()).getBytes();
- response.getOutputStream().write(theByteArray);
- FacesContext.getCurrentInstance().responseComplete();
Add Comment
Please, Sign In to add comment