*
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes setContentType Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "setContentType " Watch "setContentType " New topic
Author

setContentType

Ramakrishnan Ponmudi
Ranch Hand

Joined: Apr 20, 2004
Posts: 72
Is it mandatory to call setContentType before calling getWriter() or getOutputStream on response object if content type is other than "text/html". If i am not setting it, can i get any errors?
Hendy Setyo Mulyo
Ranch Hand

Joined: Dec 01, 2004
Posts: 219

There will no be error in the server. But you will not get the desired result when it displayed in the client (browser) (It will display characters in the browser). It because the browser will always assume you want to display text/html.


Hendy Setyo Mulyo
SCJP 1.4 (95%), SCWCD 1.4 (94%)
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: setContentType
 
Similar Threads
setContentType
setContentType()
setContentType(),
setContentType and getOutputStream
Using getInputStream and file upload