myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wjones14 <>
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

The code change was like this:

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

View this message in context:
Sent from the MyFaces - Users mailing list archive at

View raw message