myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wjones14 <bi...@snet.net>
Subject Re: validation with commandLink and target = _blank
Date Thu, 19 Apr 2007 17:57:28 GMT

I just wanted to reply that I found an easy solution that works well, and the
customer is happy with it.  Instead of opening the PDF report inline in a
new browser window, I am now setting the response header disposition type to
be "attachment" instead of "inline".  So when the report is streamed back,
the user gets a standard Windows prompt to Open, Save, or Cancel the PDF
file.   If there are validation errors, the backing bean simply posts a
FacesMessage with the error, and returns null to redisplay the parameter
page.

The code change was like this:

        FacesContext context = FacesContext.getCurrentInstance();
        HttpServletResponse response = (HttpServletResponse) context
                .getExternalContext().getResponse();
        response.setHeader("Content-Type", "application/pdf");
        response.setHeader("Content-Disposition", "attachment; filename=" +
fileName);

-- 
View this message in context: http://www.nabble.com/validation-with-commandLink-and-target-%3D-_blank-tf3601961.html#a10083530
Sent from the MyFaces - Users mailing list archive at Nabble.com.


Mime
View raw message