Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

JspʵÏÖÎļþÏÂÔع¦Äܵķ½·¨

 
£±.×îÖ±½Ó×î¼òµ¥µÄ£¬·½Ê½ÊÇ°ÑÎļþµØÖ·Ö±½Ó·Åµ½htmlÒ³ÃæµÄÒ»¸öÁ´½ÓÖС£ÕâÑù×öµÄȱµãÊÇ°ÑÎļþÔÚ·þÎñÆ÷ÉϵÄ·¾¶±©Â¶ÁË£¬²¢ÇÒ»¹ÎÞ·¨¶ÔÎļþÏÂÔؽøÐÐÆäËüµÄ¿ØÖÆ£¨ÈçȨÏÞ£©¡£Õâ¸ö¾Í²»Ð´Ê¾ÀýÁË¡£
 
£².ÔÚ·þÎñÆ÷¶Ë°ÑÎļþת»»³ÉÊä³öÁ÷£¬Ð´Èëµ½response£¬ÒÔresponse°ÑÎļþ´øµ½ä¯ÀÀÆ÷£¬ÓÉä¯ÀÀÆ÷À´ÌáʾÓû§ÊÇ·ñÔ¸Òâ±£´æÎļþµ½±¾µØ¡££¨Ê¾ÀýÈçÏ£©
 
 
<%
response.setContentType(fileminitype);
response.setHeader("Location",filename);
response.setHeader("Cache-Control", "max-age=" + cacheTime);
//filenameÓ¦¸ÃÊDZàÂëºóµÄ(utf-8)
response.setHeader("Content-Disposition", "attachment; filename=" + filename);

response.setContentLength(filelength);
OutputStream outputStream = response.getOutputStream();
InputStream inputStream = new FileInputStream(filepath);
byte[] buffer = new byte[1024];
int i = -1;
while ((i = inputStream.read(buffer)) != -1) {
outputStream.write(buffer, 0, i);
}
outputStream.flush();
outputStream.close();
inputStream.close();
outputStream = null;
%>
 
£³.¼ÈÈ»ÊÇJSPµÄ»°£¬»¹ÓÐÒ»ÖÖ·½Ê½¾ÍÊÇÓÃAppletÀ´ÊµÏÖÎļþµÄÏÂÔØ¡£²»¹ý¿Í»§Ê×ÏȵÃÐÅÈÎÄãµÄÕâ¸öAppletС³ÌÐò£¬ÓÉÕâ¸ö³ÌÐòÀ´½ÓÊÜÓÉservlet·¢ËÍÀ´µÄÊý¾ÝÁ÷£¬²¢Ð´Èëµ½±¾µØ¡£
servlet¶ËʾÀý
 
 
public void service(HttpServletRequest req, HttpServletResponse res)
throws ServletException, IOException {
res.setContentType(" text/plain ");
OutputStream outputStream = null;
try {
outputStream = res.getOutputStream();
//°ÑÎļþ·¾¶ÎªsrcFileµÄÎļþдÈëoutputStreamÖÐ
popFile(srcFile, outputStream)) ;

} catch (IOException e) {
e.printStackTrace();
}
}
 
JApplet¶ËʾÀý
 
 
URLConnection con;
try {
//urlÊDZ»µ÷ÓõÄSERVLETµÄÍøÖ· Èç *.do
con = url.openConnection();
con.setUseCaches(false);
con.setDoInput(true);
con.setDoOutput(true);
con.setRequestProper


Ïà¹ØÎĵµ£º

FreeBSD 7.0 °²×°ÅäÖÃJSP»·¾³apache+apache

ÎÒÏÈ˵Ã÷Ò»ÏÂÅäÖû·¾³µÄ´ó¸ÅÇé¿ö£º
* FreeBSD 7.0-RELEASE
* apache-2.2.9
* mod_jk-ap2-1.2.26
* diablo-jdk-1.6.0.07.02
* tomcat-6.0.16
¾ßÌåµÄ°æ±¾ÐÅÏ¢ÏÔʾÈçÏ£º
freebsd# pkg_info
apache-2.2.9_5 Version 2.2.x of Apache web server&nbs ......

jspÖ®session

     session¾ÍÊÇÒ»¸öÈ«¾Ö±äÁ¿£¬ÊÇä¯ÀÀÆ÷Ïß³ÌÔÚ·þÎñÆ÷¶ËµÄ´úÀí¡£web·þÎñ³ÌÐòÖ»Òª´ò¿ª£¬session¾Í»á´æÔÚ£¬µ±ÄãµÚÒ»´Î·ÃÎÊʱ£¬session»á×Ô¶¯ÎªÄã·ÖÅäÒ»¸ösession ID£¬ËùÒÔsessionΪн¨Á¢µÄ£¬ËùÒÔsession.isNew()Ϊtrue¡£µ±ÄãË¢ÐÂÒ³Ãæʱ£¬Õâ¸ösession IDÒ»Ö±´æÔÚ(session.getId()²»±ä)£¬²»»áÏûʧ£¬ËùÒÔse ......

JSPʵÀýÒ»¡¢¹ºÎï³µ


֪ʶ׼±¸£º
JDBC·ÃÎÊÊý¾Ý¿âµÄ»ù±¾²½Öè
£¨1£©¡¢½«Êý¾Ý¿âµÄJDBCÇý¶¯¼ÓÔص½¹¤³ÌÀà¿âÖС£
£¨2£©¡¢¼ÓÔØJDBCÇý¶¯£¬²¢½«Æä×¢²áµ½DriverManagerÖС£ÏÂÃæÊÇһЩÖ÷Á÷Êý¾Ý¿âµÄJDBCÇý¶¯¼ÓÔØ×¢²áÂ룺
¢Ù¡¢oracleÊý¾Ý¿â
Class.forName(“oracle.jdbc.driver.OracleDriver”).newInstance();
¢Ú¡¢Sql Server 7.0/2000Êý¾ ......

mysql ÖÐÐÂÎÅÀà×Ô¶¯»»ÐÐÏÔʾÔÚjspÒ³Ãæ

Ö»Ðè´ÓÊý¾Ý¿â²é³öÀ´ºóÔÚÏÔʾµÄµØ·½ÓÃ<pre></pre>±êÇ©ÐÞÊΣ¬ÈçÏ£º
<!--
     <div style="font-size:12px;color:green;text-align:left">
     <pre>
      <%=
        &n ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ