aspose file tools*
The moose likes JSP and the fly likes setContentType() does nothing. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "setContentType() does nothing. " Watch "setContentType() does nothing. " New topic
Author

setContentType() does nothing.

Jamin Williams
Ranch Hand

Joined: Dec 16, 2003
Posts: 44
Hello all,
I want my JSP page to return plain text to the browser so I used:
response.setContentType("text/plain");
Instead of a page displaying plain text (which is what I want) the browser keeps poping up a message prompting me to either open or save the results.
The browser does not seem to be getting the content type information. The file type in the Save/Open dialog is empty.
What am I missing?
Thanks,
Jamin
[ February 21, 2004: Message edited by: Jamin Williams ]
[ February 21, 2004: Message edited by: Bear Bibeault ]

Jamin Williams<br />SCJP, SCWCD
Rob Ross
Bartender

Joined: Jan 07, 2002
Posts: 2205
Check to see that your browser is set up to display a MIME type of text/plain. It might only be set up for displaying text/html.


Rob
SCJP 1.4
Jamin Williams
Ranch Hand

Joined: Dec 16, 2003
Posts: 44
Originally posted by Rob Ross:
Check to see that your browser is set up to display a MIME type of text/plain. It might only be set up for displaying text/html.

How do I do that? I am using IE and I don't see a place to do that in the config setting. Is there a file I need to edit?
The stange thing is that it works if I create a compile error in the JSP code and request the page so it gives me the error page. Then I fix the compiler error and reload the page. The plain text is generated and appears the way I expect it to. But when I click in the link to the JSP page then I get the Save/Open dialog with the file type field blank.
Strange.
Jamin
[ February 21, 2004: Message edited by: Jamin Williams ]
Jamin Williams
Ranch Hand

Joined: Dec 16, 2003
Posts: 44
I finally found someone who ran into the same problem and had an answer.
Problem with sending plain text
Jamin
Jamin Williams
Ranch Hand

Joined: Dec 16, 2003
Posts: 44
Originally posted by Jamin Williams:
Hello all,
I want my JSP page to return plain text to the browser so I used:
response.setContentType("text/plain");
Instead of a page displaying plain text (which is what I want) the browser keeps poping up a message prompting me to either open or save the results.
The browser does not seem to be getting the content type information. The file type in the Save/Open dialog is empty.
What am I missing?
Thanks,
Jamin
[ February 21, 2004: Message edited by: Jamin Williams ]
[ February 21, 2004: Message edited by: Bear Bibeault ]


Bear, at least you can explain why you keep editing my post...
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61767
    
  67

I did. Check your PMs.
[ February 21, 2004: Message edited by: Bear Bibeault ]

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Jamin Williams
Ranch Hand

Joined: Dec 16, 2003
Posts: 44
Originally posted by Bear Bibeault:
I did. Check your PMs.
[ February 21, 2004: Message edited by: Bear Bibeault ]

I don't have any new PM's
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: setContentType() does nothing.