• No replies
66 Posts

Pinned topic Opening the pdf in a new window

‏2012-04-10T14:07:37Z |

We are developing a web portal on websphere portal 6.1 with IBM RAD 8.0.3 and Faces 1.1.
In the subject portal, we try to implement a pdf creator. For that purpose we developed a pdf creator servlet based on itext library. The servlet runs properly, if we try to access it through a command

button (because we have to execute some java code before creatng the pdf) by using the following phrase inside the command button's action method;


Here, the problem is that the created pdf is opened in the same browser window,but we want to open the pdf in a new browser window. Therefore, we tried to access the Servlet by using commandlink (with

target="_blank"), but it doesn't create a new window. In order to get round this problem, we created a blankpage with the folowing code in its pageload:


But this again didn't help.The problem here is that the portlet tries to open the servlet inide the portlet's field not the browser window. (java.lang.IllegalStateException: getWriter can't be used after

getOutputStream was invoked)

and using the redirect() instead of dispatch


didn't work either.

Do you have any idea about how to access the servlet and opwn the pdf in a new browser window?

Best Regards,