Sets the Content-Type header. Content-Type identifies the MIME type of the response document and the character set encoding.
To set the Content-Type header, use the following code:
response.setContentType("text/html; charset=gbk");
The default MIME type is text/plain. Some common MIME types include:
------------------------------------------------------------------
HTML format (.htm or .html): text/html
Adobe Portable Document (pdf): application/pdf
Microsoft Word (.doc): application/msword
Microsoft Excel (.xls): application/msexcel
Microsoft Powerpoint (.ppt): application/ms-powerpoint
Realaudio (.rm, .ram): audio/x-pn-realaudio
Text format (.txt): text/txt
Zipped files (.zip): application/zip
response.setContentType( "application/msword" );
response.setContentType("application/vnd.ms-excel");
response.setHeader("Content-type","application/pdf");
详请访问以下地址