aspose file tools*
The moose likes JSP and the fly likes Open File in New Browse Window Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Open File in New Browse Window" Watch "Open File in New Browse Window" New topic
Author

Open File in New Browse Window

Steve Dyke
Ranch Hand

Joined: Nov 16, 2004
Posts: 1488
    
    1
I am using the following code to open a pdf file. A button is located on my JSP to fire the code. The problem is the pdf file opens in the calling browser window. the users want to see it open in a separate browser window.

Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Look up the Content-Disposition response header
It can be used to suggest a file name for your response and also suggest whether the browser should display the resource as an attachment or inline.

(There is an example of it in the JSP FAQ under JspAndExcel)
[ August 20, 2007: Message edited by: Ben Souther ]

Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Steve Dyke
Ranch Hand

Joined: Nov 16, 2004
Posts: 1488
    
    1
Thanks, that fixed that part. Now what about a hypperlink? Can this be called up in a separate window?
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

If you use "attachment" instead of "inline" in your Content-Disposition header, the browser will either open the application in a new window (if there is an associated application for this mime type) or prompt the user to either "Save As" or "Open With".
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Open File in New Browse Window