开发者

Getting the PDF created using iText as pop up in JSF

I want create a pdf using iText. The method which does this is a JSF bean. What I want is, on click of a commandButton in JSF page, the PDF is开发者_StackOverflow社区 created. It must then open as popup in a new window(or tab) keeping the JSF page unaltered. How can I accomplish this ? I know there is a way in javascript in which we can open a new window using window.open(), but then I want to access the list from JSF bean to create pdf. Thanks.


Add target="_blank" attribute to the <h:form> and it will submit into a new tab/window.


You could replace the commandButton with a <a href="pathToPdfServlet" target="_blank">PDF</a>, which is mapped to a servlet. This servlet would set the response content type to application/pdf, call iText and write PDF to the output stream.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜