ÓÃJspÊä³öWord,PDFµÈÎļþʱ½øÐеÄÉèÖÃ
response.setContentType( "application/pdf" ); // MIME type for pdf doc
response.setHeader("Content-Disposition","attachment;filename=output.pdf;");
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
Ïà¹ØÎĵµ£º
jspÒ³ÃæÖ®¼äµÄ´«ÖµÂÒÂëÎÊÌ⣬×ܽáÈçÏ£º
a.jspÍùb.jsp´«Öµ£º
a.jspÒ³ÃæÄÚÈÝ£º
<%@ page language="java" import="java.util.*" pageEncoding="GB2312"%>
<form action="b.jsp">
name:<input type=text name=name>
<input type=s ......
½¨Á¢×ÔÒѵÄwebĿ¼
¿ÉÒÔ½«JSPÒ³Ãæ³ÌÐò²¿ÊðÔÚTomcat·þÎñÆ÷µÄĬÈÏwebĿ¼Ï£¬Ò²¿ÉÒÔ²¿ÊðÔÚ×ÔÒÑ´´½¨µÄwebĿ¼Ï¡£ÏÂÃæÊÇ´´½¨webĿ¼µÄ²½Ö裺
1)£®ÔÚ·þÎñÆ÷ÉÏ´´½¨×ÔÒѵÄĿ¼
È磬´´½¨Ò»Ä¿Â¼£º E:\test\10
2)£®ÅäÖÃwebĿ¼
ÓüÇʱ¾´ò¿ª \Tomcat 5.0\confĿ¼ÏµÄÎļþs ......
Ò».request¶ÔÏó
¿Í»§¶ËµÄÇëÇóÐÅÏ¢±»·â×°ÔÚrequest¶ÔÏóÖУ¬Í¨¹ýËü²ÅÄÜÁ˽⵽¿Í»§µÄÐèÇó£¬È»ºó×ö³öÏìÓ¦¡£ËüÊÇHttpServletRequestÀàµÄʵÀý¡£
µ±request¶ÔÏó»ñÈ¡Óû§Ìá½»µÄºº×Ö×Ö·ûʱ£¬»á²úÉúÂÒÂ룬ÓÉÏÂÃæµÄ·½·¨¿ÉÒÔ½â¾ö£º
¡¡¡¡ Sting s2 = new String(s1.getBytes("iso8859-1"),"GB2312") ......
Perl¡¢PHP¡¢ASP¡¢JSP¼¼Êõ±È½Ï
±¾ÎĽ«¶ÔĿǰ×î³£ÓõÄËÄÖÖ¶¯Ì¬ÍøÒ³ÓïÑÔPerl£¨Practical Extraction and Report Language£©¡¢PHP£¨Hypertext Preprocessor£©¡¢ASP£¨Active Server Pages£©¡¢JSP£¨JavaServer Pages£©½øÐÐһЩ¼¼ÊõÐԵıȽϡ£
¡¡¡¡Perl
¡¡¡¡Perl£¨Practical Extraction and Report Language£©ÊÇÒ»ÖֺܹÅÀϵĽű ......