Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

setContentType() does nothing.

 
Jamin Williams
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
Rob Ross
Bartender
Posts: 2205
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Jamin Williams
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I finally found someone who ran into the same problem and had an answer.
Problem with sending plain text
Jamin
 
Jamin Williams
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 65225
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I did. Check your PMs.
[ February 21, 2004: Message edited by: Bear Bibeault ]
 
Jamin Williams
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic