Solved

I want to change the Title in servlet

Posted on 2012-03-13
3
235 Views
Last Modified: 2012-03-25
if (serviceOperation.getContentDisposition().equalsIgnoreCase("inline")) {
                                response.setHeader("Content-disposition","inline; filename=\"" + reportFileName    + "\"");
                            } else {
                                response.setHeader("Content-disposition","attachment; filename=\"" + reportFileName    + "\"");
                            }
                            response.setContentType(mimetype);
                            response.getOutputStream().write(Base64.decode(content));

How could I set the Browser Title in Above code

please help me
0
Comment
Question by:stmani2005
3 Comments
 
LVL 20

Accepted Solution

by:
chaitu chaitu earned 500 total points
ID: 37718631
http://stackoverflow.com/questions/1058959/how-to-change-the-title-of-a-browser-page-which-a-servlet-streamed-a-pdf-to

using javascript it will be more easy;

document.title = "This is the new page title.";
0
 
LVL 8

Author Comment

by:stmani2005
ID: 37718729
Could you please specify the another way in servlet
0
 
LVL 3

Expert Comment

by:kalpeshchavan
ID: 37719112
sorry you cant specify title in document other than html

if document is diffrent like pdf ,doc,xls then it is not possible

but if you want to show title then put your report servlet in iframe tag

example as follow

test.html


<html>
<head> <title>  Your Title </title>
<body>
 
 <iframe src='yourServletAddress'>
 
 </iframe>

</body>
</html>
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
The viewer will learn how to implement Singleton Design Pattern in Java.

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now