aspose file tools*
The moose likes Servlets and the fly likes File output format Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "File output format" Watch "File output format" New topic
Author

File output format

Ananth Ram
Ranch Hand

Joined: Jan 18, 2001
Posts: 99
Hi All,

I am trying to open a license file using Servlet in a new browser window. The file opens, but the format is not correct.

Example , input file is as below.


In the browser, the output is as below.
Typically my code in the servlet is below.



Am I missing something on formatting/contentType. Could someone help me out.

Thanks in advance for your help.

Thanks,
Ananth Ram
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61623
    
  67

If it's not HTML, why are you saying that it is?

The browser is trying to interpret it as HTML, in which whitespace, such as line-feeds, are ignored.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Ananth Ram
Ranch Hand

Joined: Jan 18, 2001
Posts: 99
Thanks Bear,

So, do you mean I need to specify just text instead of "text/html", or any other options. Please let me know.

Thanks,
Ananth Ram
Ananth Ram
Ranch Hand

Joined: Jan 18, 2001
Posts: 99
Also the file does not have an extension like txt/doc. It is plain. I tried setting to "text/plain", did not work.

Thanks,
Ananth Ram
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61623
    
  67

ItDoesntWorkIsUseless
Ananth Ram
Ranch Hand

Joined: Jan 18, 2001
Posts: 99
The "text/plain" works fine.




Thanks for pointers.

Ananth Ram
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: File output format