ÓÃ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
Ïà¹ØÎĵµ£º
'-------------------------------------------------------------------ÒÔÏÂÊǵǼ´úÂë
<%@ page contentType="text/html; charset=gb2312"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3 ......
Ò»¡¢JSPÒ³ÃæÏÔʾÂÒÂë
¶þ¡¢±íµ¥Ìá½»ÖÐÎÄʱ³öÏÖÂÒÂë
Èý¡¢Êý¾Ý¿âÁ¬½Ó
´ó¼ÒÔÚJSPµÄ¿ª·¢¹ý³ÌÖУ¬¾³£³öÏÖÖÐÎÄÂÒÂëµÄÎÊÌ⣬¿ÉÄÜÒ»ÖÁÀ§ÈÅ×ÅÄú£¬ÎÒÏÖÔÚ°ÑÎÒÔÚJSP¿ª·¢ÖÐÓöµ½
µÄÖÐÎÄÂÒÂëµÄÎÊÌâ¼°½â¾ö°ì·¨Ð´³öÀ´¹©´ó¼Ò²Î¿¼¡£
Ò»¡¢JSPÒ³ÃæÏÔʾÂÒÂë
ÏÂÃæµÄÏÔÊ¾Ò³Ãæ(display.jsp)¾Í³öÏÖÂÒÂ룺
<html>
<head>
<tit ......
jspʹÓÃ×é¼þ½øÐÐÎļþÉÏ´«
WEBÎļþÉÏ´«¿ÉÄÜÊÇÍøÕ¾½¨ÉèÖÐ×î³£ÓõŦÄÜÖ®Ò»£¬ÎÒÔÚÏîÄ¿¿ª·¢Öм¸ºõ¶¼ÐèҪʵÏÖÎļþÉÏ´«¹¦ÄÜ£®Ç°¶Îʱ¼ä×Ô¼ºËѼ¯ÁËһЩÉÏ´«×é¼þ£®ÕâÆªÎÄÕÂÖн«½éÉÜÕâЩ×é¼þµÄʹÓ÷½·¨£¬²¢ÇұȽϸ÷×ÔµÄÓÅÁÓ£®
Ò»£¬smartupload×é¼þ£®
ÎÒÏëÖ»Òª×ö¸öÎļþÉÏ´«µÄÅóÓѶ¼ÖªµÀÕâ¸ö×é¼þ£¬ÎÒÈÏʶµÄÈËÖÐʹÓÃ×î¶àµÄÒ²ÊÇËü£¡ÎÒ¸ ......
½¨Á¢Ìõ¼þÊ×ÏÈÒ»¶¨ÒªÈ·¶¨×Ô¼ºµÄmysql£¬tomcat,eclipseÁ¬½ÓÊÇÕýÈ·µÄ¡£
index.jspºÜ¼òµ¥£¬¾ÍÒ»¸öÌø×ª¡£
<%
response.sendRedirect("lg.jsp");
%>
lg.jsp ʵÏֵǼ¿ò¼Ü
<%@ page contentType="text/html; charset=utf-8" %>
<html>
<head>
<title>
login
</title>
</hea ......
·½·¨Ò»¡¢
login.html
<html>
<head>
<title>Óû§µÇ¼</title>
<meta http-equiv="content-type" content="text/html; charset=gb2312">
</head>
<script language="javascript">
&nbs ......