aspose file tools*
The moose likes Servlets and the fly likes How to set browser title using HTTP Header from a Servlet? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "How to set browser title using HTTP Header from a Servlet?" Watch "How to set browser title using HTTP Header from a Servlet?" New topic
Author

How to set browser title using HTTP Header from a Servlet?

Sai Prasad
Ranch Hand

Joined: Feb 25, 2002
Posts: 560
All,
I have a servlet that serves PDF documents. The servlet reads the pdf file,set the header content to application/pdf and sends the file data using response.getOutputStream().
It works fine and the PDF document is openend with in the IE browser using the plugin. I like to do two things:
1) Change the title of the IE browser window to the PDF file name
2) When I press the "Save" button with in the Acrobat Reader application, I want the "Save As" dialog to contain pdf file name in the text field: "File name". Right now it appears as *.pdf.
Any help is greatly appreciated.
Ron Newman
Ranch Hand

Joined: Jun 06, 2002
Posts: 1056
The title of the browser window always comes from the <title> element of an HTML page.


Ron Newman - SCJP 1.2 (100%, 7 August 2002)
Sai Prasad
Ranch Hand

Joined: Feb 25, 2002
Posts: 560
I do see a HTTP header parameter named "Title". It doesn't seem to display the title after I set the value.
[ July 28, 2003: Message edited by: Sai Prasad ]
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61650
    
  67

The HTTP headers and the HTML <header> are not the same thing...
hth,
bear


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: How to set browser title using HTTP Header from a Servlet?