jspʵÏÖÎļþÏÂÔØÓëÖÐÎÄÎļþÃûÂÒÂëÎÊÌâ½â¾ö
ÎÊÌâÈçÏ£º
֮ǰ,д¹ýÒ»¸öDownload.jspÎļþ,¿ÉÒÔ½â¾öÏÂÔØÎļþÂÒÂëÎÊÌâ(ÖîÈç:DOC,XSLÎļþµÈµÈ).
ºóÀ´·¢ÏÖ,Óöµ½ÖÐÎÄÃûµÄÎļþµÄʱºò,ÎļþÏÂÔؽ«»á±¨´í~~~~
½ñÌì,ͨ¹ý¸ÄдÔDownload.jspÎļþÒѾ³¹µ×½â¾öÁËÕâ¸öÎÊÌâ~
ÏÖÔÚ,°ÑÒ»ÕûÌ×µÄÎļþÉÏ´«ÏÂÔصķ½·¨¸øÌù³öÀ´~~~ÒÔ±ã´ó¼Ò½è¼ø!~!~!~!~!
×÷Õß:¹Å°£¼°·¨ÀÏ
download.jspÎļþ
---------------------------------------------------------
<%
java.io.BufferedInputStream bis=null;
java.io.BufferedOutputStream bos=null;
try{
String filename=request.getParameter("filename");
filename=new String(filename.getBytes("iso8859-1"),"gb2312");
response.setContentType("application/x-msdownload");
response.setHeader("Content-disposition","attachment; filename="+new String(filename.getBytes("gb2312"),"iso8859-1"));
bis =new java.io.BufferedInputStream(new java.io.FileInputStream(config.getServletContext().getRealPath("files/" + filename)));
bos=new java.io.BufferedOutputStream(response.getOutputStream());
byte[] buff = new byte[2048];
int bytesRead;
while(-1 != (bytesRead = bis.read(buff, 0, buff.length))) {
bos.write(buff,0,bytesRead);
}
}
catch(Exception e){
e.printStackTrace();
}
finally {
if (bis != null)bis.close();
if (bos != null)bos.close();
}
%>
×¢Ò⣬¹Ø¼ü¾ÍÊÇsetHeaderÀïµÄfilenameÐèÒªÖØбàÂë,¸ñʽÊÇISO-8859-1¾Í£Ï£ËÁË
ÒÔÏÂÊÇÎÒ×Ô¼ºÏîÄ¿ÖÐÓõ½µÄ´úÂëƬ¶Ï£¬¹©²Î¿¼:
list.jsp: ÏÔʾ¸½¼þÃû³ÆµÄÒ³Ãæ
<tr>
<td height="25" class="tdcor">¸½ ¼þ </td>
<td colspan="3"&
Ïà¹ØÎĵµ£º
oracle+jspÖÐblobÀàÐÍ´æ´¢´óÎı¾ÎÊÌâ½â¾ö·½·¨
oracle ´æ´¢´óÎı¾Ò»Ö±ÊÇÒ»¸ö¼¬ÊÖµÄÎÊÌâ¡£
Ò»¡¢´æÊý¾Ý¿â£º
<%@page contentType="text/html; charset=gb2312" language="java" import="java.sql.*" errorPage="" %>
<%
//¶¨Òå±äÁ¿
java.sql.Connection conn; //Êý¾ ......
¸Õ¿ªÊ¼Ñ§jsp£¬×öµÄÒ»µãÌý¿Î±Ê¼Ç¡£
1.jspÈý´óÖ¸Áî
<%@ page ~~~~~~~~ %>
<%@ include file=""%>
<%@ taglib url="" prfix=""%>
2.if(username.equals(""))
out.println("ÐÕÃû²»ÄÜΪ¿Õ£¬Çë<a href=javascript:history.back()>·µ»Ø")£»
&&·ÀÖ¹Ö±½ÓÔÚä¯À ......
×ܵÄÀ´½²£¬JavaSever PagesTM£¨JSP£©ºÍ ΢ÈíµÄActive Sever Pages£¨ASP£©ÔÚ¼¼Êõ·½ÃæÓÐÐí¶àÏàËÆÖ®´¦¡£Á½Õ߶¼ÊÇΪ»ùÓÚWEBÓ¦ÓÃʵÏÖ¶¯Ì¬½»»¥ÍøÒ³ÖÆ×÷ÌṩµÄ¼¼Êõ»·¾³Ö§³Ö¡£Í¬µÈ³Ì¶ÈÉÏÀ´½²£¬Á½Õ߶¼Äܹ»Îª³ÌÐò¿ª·¢ÈËÔ±ÌṩʵÏÖÓ¦ÓóÌÐòµÄ±àÖÆÓë×Ô´ø×é¼þÉè¼ÆÍøÒ³´ÓÂß¼ÉÏ·ÖÀëµÄ¼¼Êõ¡£¶øÇÒÁ½Õ߶¼Äܹ»Ìæ´úCGIʹÍøÕ¾½¨ÉèÓë·¢Õ¹±äµÄ½ÏΪ ......
ÔÚjspÖУ¬Èç¹ûÔÚurlÖд«µÝÖÐÎÄʱ»á³öÏÖÂÒÂ룬ÔÚÍøÉϹØÓÚÕâÒ»ÎÊÌâµÄ½â¾ö·½·¨Î廨°ËÃÅ£¬µ«¶¼²»ÊǺÜ×àЧ£¡Æäʵ½â¾ö·½·¨·Ç³£¼òµ¥£º µÚÒ»²½£º±àÂ루ÒÔ´«µÝµÄ²ÎÊýΪstrΪÀý£© ÔÚ´«µÝÊý¾ÝÇ°½«str½øÐбàÂëJava.net.URLEncoder.encode(str) µÚ¶þ²½£º½âÂë ÔÚ»ñÈ¡Êý¾Ý¶Ë½«µÃµ½µÄÊý¾Ý½øÐнâÂë new String£¨str.getBytes("ISO8859_1")£©
......
1¡¢·Ö±ð°²×°Èý¸ö»·¾³£¬²¢ÉèÖò»Í¬¶Ë¿Ú
PHP:80
JSP:8080
ASP:8081
2¡¢ÉèÖÃ/Apache2/conf/httpd.conf
È¥µôÒÔÏÂÈýÐÐÇ°µÄ×¢ÊÍ£º
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_connect_module modules/mod_proxy_connect.so
LoadModule proxy_http_module modules/mod_proxy_http.so
¼ÓÈëÒÔϼ¸ÐУº ......