Hello and happy new year
Im' using this action method to generate dynamicaly pdf file and send
them to the browser
public String generaContratto(){
FacesContext facesContext = FacesContext.getCurrentInstance();
HttpServletResponse response = (HttpServletResponse)
facesContext.getExternalContext().getResponse();
response.setContentType("application/pdf");
String fileName = "blabla.pdf";
response.setHeader("Content-disposition", " attachment;
filename=\"" + fileName + "\"");
try {
ServletOutputStream out;
out = response.getOutputStream();
ProxyDaoFactory daoFactory = new ProxyDaoFactory();
DocumentBuilder builder = new
DocumentBuilderWrapper(daoFactory,
facesContext.getExternalContext().getInitParameter("fileValut"));
builder.write(offerta,out);
} catch (Exception e) {
...
return "ERROR"
}
facesContext.responseComplete();
return "OK";
}
Everithing works fine: the pdf is generated, downloaded etc.
But if I trigger some other action on the same view it just render the
page again.. I think it does render response phase. Model is not
updated. It act as if navigation (the ugly back button!) button where
used.
Any ideas?
--
::SammyRulez::
http://www.kyub.com/blog/
-----------------------------------------------------------------
La programmazione รจ per un terzo interpretazione e per due terzi ispirazione.
E per un terzo mistificazione