ÓÃ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
Ïà¹ØÎĵµ£º
setAttribute()ÊÇÓÃÓÚ·þÎñÆ÷¶ËÉèÖÃÊôÐÔÏò¿Í»§¶Ë·¢Ë͸ÃÊôÐÔ£¬ÔÚ¿Í»§¶Ëͨ¹ýgetAttribute£¨£©»ñµÃÊôÐÔ¡£setAttribute()Ò²ÄÜ´«µÝ¶ÔÏó¡£
setParameter()ÊÇ¿Í»§¶ËÏò·þÎñÆ÷¶Ë·¢ËÍÊôÐÔ£¬Ö»ÄÜ´«×Ö·û£¬ÓÃÓÚget/postµÄÊýÖµ´«µÝ£¬ÔÚ·þÎñ¶ËÓÃgetParameter£¨£©»ñÈ¡£¬Ò³ÃæÖÐÓÐforward´Ó¶¨ÏòÒ³ÃæµÄµØÖ·ÖеIJÎÊýÒ²ÄÜÓÃgetParameter£¨£©»ñÈ¡¡ ......
Ò»£º¹¤³§Ä£Ê½³öÏÖµÄÔÒò
Ò»°ãÉè¼Æģʽ£º
view plaincopy to clipboardprint?
interface Fruit{
public void eat();
}
class Apple implements Fruit{
&n ......
ÒýÓÃ×Ô: http://hi.baidu.com/tickwudi/blog/item/1c0ddb6dd4e821fc4316949b.html
<%@ page language="java" import="java.util.*" pageEncoding="ISO-8859-1"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort ......
ÎÒÃǶ¼ÖªµÀÔÚjspÖÐincludeÓÐÁ½ÖÖÐÎʽ,·Ö±ðÊÇ
< %@ include file=” ”% >
< jsp:include page=” ” flush=”true”/ >
Ç°ÕßÊÇÖ¸ÁîÔªËØ¡¢ºóÕßÊÇÐÐΪԪËØ¡£
¾ßÌåËüÃǽ«Ôںδ¦Óã¿ÈçºÎÓü°ËüÃÇÓÐʲôÇø±ð£¿ÕâÓ¦¸ÃÊǺܶàÈË¿´µ½Ëü¶¼»áÏëµ½µÄÎÊÌâ¡£ÏÂÃæÒ»ÆðÀ´¿´¿´°É¡£
ͨ³£ ......
ΪʲôGenericServletÔÚinit(ServletConfig config)»ù´¡ÉÏÔö¼ÓÁËÒ»¸öinit()·½·¨£¿
init()·½·¨±»GenericServlet.init(ServletConfig config)·½·¨µ÷Óá£
init()·½·¨·½±ãÁË¿ª·¢ÈËÔ±¶¨ÖÆServletµÄ³õʼ»¯£¬¶øÎÞÐëȥά»¤ServletConfig¶ÔÏóµÄ´æ´¢¹¤×÷¡£
ÖØдGenericServlet.init(ServletConfig config)±ØÐëÒªÏÔʾµÄµ÷ÓÃsuper ......