aspose file tools*
The moose likes Servlets and the fly likes How to get rid off browser naming conventions Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "How to get rid off browser naming conventions" Watch "How to get rid off browser naming conventions" New topic
Author

How to get rid off browser naming conventions

tanu dua
Ranch Hand

Joined: Apr 05, 2004
Posts: 145
Hi,

I am using a servlet to send an excel file to the browser with the specified name say abc.xls and the browser gives 3 options :
1) open
2) save
3) cancel.

Now when i click open , the browser opens the file in excel like abc[1].xls in IE (6 and 7) and abc-1.xls in Firefox which I dont want . Is there any way to change the append string i.e. [1].

Or do i have to do client side so have to do all the hard work ?

Thanks
Rahul Bhattacharjee
Ranch Hand

Joined: Nov 29, 2005
Posts: 2308
This might be useful for you.


Rahul Bhattacharjee
LinkedIn - Blog
tanu dua
Ranch Hand

Joined: Apr 05, 2004
Posts: 145
Thanks Rahul.

But I cudn't get what I want it . I am able to get the data in excel and I can open it , save it , so no issues are there except the name that browser uses to open the file .

When say browser gets request to open the file say abc.xsl it will open it like abc[1].xsl (IE 6 and 7) and abc-1(Firefox).This [1] or -1 I dont want in the filename when it is opened.
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

The Content-Disposition header allows you to send the desired name of the file to the browser. There is an example of its use in the FAQ entry that Raul gave you.


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Stan James
(instanceof Sidekick)
Ranch Hand

Joined: Jan 29, 2003
Posts: 8791
I thought I saw that [1] only when there was already a copy of the file in browser cache, ie the 2nd time I opened it, maybe with the first copy still open. Or did I just guess wrong about what was going on?


A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to get rid off browser naming conventions