jQuery in Action, 3rd edition
The moose likes Struts and the fly likes Opening content in a new window. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of OCA Java SE 8 Programmer I Study Guide this week in the OCAJP 8 forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Opening content in a new window." Watch "Opening content in a new window." New topic

Opening content in a new window.

Karl Beowulph
Ranch Hand

Joined: May 31, 2004
Posts: 130

In my current project, I generate a pdf (using iText) within my Action class and display it to the user.

What do I have to change so that the pdf is opened in a new window instead of the current one that the user is viewing?

Can I send a command to the clients browser to open a new window first? If so, how would I specify to use the new window instead of the original?
Marc Peabody
pie sneak

Joined: Feb 05, 2003
Posts: 4727

You can set the header's Content-disposition to attachment.

If you'd rather keep it inline, then you'll probably have to do something with target="_blank" and refresh the new page to hit the Action that generates the pdf and display it there.

A good workman is known by his tools.
I agree. Here's the link: http://aspose.com/file-tools
subject: Opening content in a new window.
It's not a secret anymore!