This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
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


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
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: 60737
    
  65

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: 60737
    
  65

ItDoesntWorkIsUseless
Ananth Ram
Ranch Hand

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




Thanks for pointers.

Ananth Ram
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: File output format
 
Similar Threads
NX: Bext free style checker ?
NoInitialContextException In EJB3.0with JBOSS
Simple Midi Problem
Running with jar files in jar file.
Perils of GPL'ed java