锘??xml version="1.0" encoding="utf-8" standalone="yes"?>
鏂偣緇紶鐨勫師鐞?/span>
鍏跺疄鏂偣緇紶鐨勫師鐞嗗緢綆鍗曪紝灝辨槸鍦?Http 鐨勮姹備笂鍜屼竴鑸殑涓嬭澆鏈夋墍涓嶅悓鑰屽凡銆?
鎵撲釜姣旀柟錛屾祻瑙堝櫒璇鋒眰鏈嶅姟鍣ㄤ笂鐨勪竴涓枃鏃訛紝鎵鍙戝嚭鐨勮姹傚涓嬶細
鍋囪鏈嶅姟鍣ㄥ煙鍚嶄負 wwww.sjtu.edu.cn錛屾枃浠跺悕涓?down.zip銆?
GET /down.zip HTTP/1.1
Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/vnd.ms-
excel, application/msword, application/vnd.ms-powerpoint, */*
Accept-Language: zh-cn
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)
Connection: Keep-Alive
鏈嶅姟鍣ㄦ敹鍒拌姹傚悗錛屾寜瑕佹眰瀵繪壘璇鋒眰鐨勬枃浠訛紝鎻愬彇鏂囦歡鐨勪俊鎭紝鐒跺悗榪斿洖緇欐祻瑙堝櫒錛岃繑鍥炰俊鎭涓嬶細
200
Content-Length=106786028
Accept-Ranges=bytes
Date=Mon, 30 Apr 2001 12:56:11 GMT
ETag=W/"02ca57e173c11:95b"
Content-Type=application/octet-stream
Server=Microsoft-IIS/5.0
Last-Modified=Mon, 30 Apr 2001 12:56:11 GMT
鎵璋撴柇鐐圭畫浼狅紝涔熷氨鏄浠庢枃浠跺凡緇忎笅杞界殑鍦版柟寮濮嬬戶緇笅杞姐傛墍浠ュ湪瀹㈡埛绔祻瑙堝櫒浼犵粰 Web 鏈嶅姟鍣ㄧ殑鏃跺欒澶氬姞涓鏉′俊鎭?-- 浠庡摢閲屽紑濮嬨?
涓嬮潰鏄敤鑷繁緙栫殑涓涓?嫻忚鍣?鏉ヤ紶閫掕姹備俊鎭粰 Web 鏈嶅姟鍣紝瑕佹眰浠?2000070 瀛楄妭寮濮嬨?
GET /down.zip HTTP/1.0
User-Agent: NetFox
RANGE: bytes=2000070-
Accept: text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2
浠旂粏鐪嬩竴涓嬪氨浼氬彂鐜板浜嗕竴琛?RANGE: bytes=2000070-
榪欎竴琛岀殑鎰忔濆氨鏄憡璇夋湇鍔″櫒 down.zip 榪欎釜鏂囦歡浠?2000070 瀛楄妭寮濮嬩紶錛屽墠闈㈢殑瀛楄妭涓嶇敤浼犱簡銆?
鏈嶅姟鍣ㄦ敹鍒拌繖涓姹備互鍚庯紝榪斿洖鐨勪俊鎭涓嬶細
206
Content-Length=106786028
Content-Range=bytes 2000070-106786027/106786028
Date=Mon, 30 Apr 2001 12:55:20 GMT
ETag=W/"02ca57e173c11:95b"
Content-Type=application/octet-stream
Server=Microsoft-IIS/5.0
Last-Modified=Mon, 30 Apr 2001 12:55:20 GMT
鍜屽墠闈㈡湇鍔″櫒榪斿洖鐨勪俊鎭瘮杈冧竴涓嬶紝灝變細鍙戠幇澧炲姞浜嗕竴琛岋細
Content-Range=bytes 2000070-106786027/106786028
榪斿洖鐨勪唬鐮佷篃鏀逛負 206 浜嗭紝鑰屼笉鍐嶆槸 200 浜嗐?
鐭ラ亾浜嗕互涓婂師鐞嗭紝灝卞彲浠ヨ繘琛屾柇鐐圭畫浼犵殑緙栫▼浜嗐?
浠庤緭鍏ユ祦涓彇鍑虹殑瀛楄妭嫻佸氨鏄?down.zip 鏂囦歡浠?2000070 寮濮嬬殑瀛楄妭嫻併傚ぇ瀹剁湅錛屽叾瀹炴柇鐐圭畫浼犵敤 Java 瀹炵幇璧鋒潵榪樻槸寰堢畝鍗曠殑鍚с傛帴涓嬫潵瑕佸仛鐨勪簨灝辨槸鎬庝箞淇濆瓨鑾峰緱鐨勬祦鍒版枃浠朵腑鍘諱簡銆?
鎬庝箞鏍鳳紝涔熷緢綆鍗曞惂銆傛帴涓嬫潵瑕佸仛鐨勫氨鏄暣鍚堟垚涓涓畬鏁寸殑紼嬪簭浜嗐傚寘鎷竴緋誨垪鐨勭嚎紼嬫帶鍒剁瓑絳夈?
涓昏鐢ㄤ簡 6 涓被錛屽寘鎷竴涓祴璇曠被銆?
SiteFileFetch.java 璐熻矗鏁翠釜鏂囦歡鐨勬姄鍙栵紝鎺у埗鍐呴儴綰跨▼ (FileSplitterFetch 綾?)銆?
FileSplitterFetch.java 璐熻矗閮ㄥ垎鏂囦歡鐨勬姄鍙栥?
FileAccess.java 璐熻矗鏂囦歡鐨勫瓨鍌ㄣ?
SiteInfoBean.java 瑕佹姄鍙栫殑鏂囦歡鐨勪俊鎭紝濡傛枃浠朵繚瀛樼殑鐩綍錛屽悕瀛楋紝鎶撳彇鏂囦歡鐨?URL 絳夈?
Utility.java 宸ュ叿綾伙紝鏀句竴浜涚畝鍗曠殑鏂規硶銆?
TestMethod.java 嫻嬭瘯綾匯?
涓嬮潰鏄簮紼嬪簭錛?/p>
/* /* * SiteFileFetch.java */ package NetFox; import java.io.*; import java.net.*; public class SiteFileFetch extends Thread { SiteInfoBean siteInfoBean = null; // 鏂囦歡淇℃伅 Bean long[] nStartPos; // 寮濮嬩綅緗? long[] nEndPos; // 緇撴潫浣嶇疆 FileSplitterFetch[] fileSplitterFetch; // 瀛愮嚎紼嬪璞? long nFileLength; // 鏂囦歡闀垮害 boolean bFirst = true; // 鏄惁絎竴嬈″彇鏂囦歡 boolean bStop = false; // 鍋滄鏍囧織 File tmpFile; // 鏂囦歡涓嬭澆鐨勪復鏃朵俊鎭? DataOutputStream output; // 杈撳嚭鍒版枃浠剁殑杈撳嚭嫻? public SiteFileFetch(SiteInfoBean bean) throws IOException { siteInfoBean = bean; //tmpFile = File.createTempFile ("zhong","1111",new File(bean.getSFilePath())); tmpFile = new File(bean.getSFilePath()+File.separator + bean.getSFileName()+".info"); if(tmpFile.exists ()) { bFirst = false; read_nPos(); } else { nStartPos = new long[bean.getNSplitter()]; nEndPos = new long[bean.getNSplitter()]; } } public void run() { // 鑾峰緱鏂囦歡闀垮害 // 鍒嗗壊鏂囦歡 // 瀹炰緥 FileSplitterFetch // 鍚姩 FileSplitterFetch 綰跨▼ // 絳夊緟瀛愮嚎紼嬭繑鍥? try{ if(bFirst) { nFileLength = getFileSize(); if(nFileLength == -1) { System.err.println("File Length is not known!"); } else if(nFileLength == -2) { System.err.println("File is not access!"); } else { for(int i=0;i<nStartPos.length;i++) { nStartPos[i] = (long)(i*(nFileLength/nStartPos.length)); } for(int i=0;i<nEndPos.length-1;i++) { nEndPos[i] = nStartPos[i+1]; } nEndPos[nEndPos.length-1] = nFileLength; } } // 鍚姩瀛愮嚎紼? fileSplitterFetch = new FileSplitterFetch[nStartPos.length]; for(int i=0;i<nStartPos.length;i++) { fileSplitterFetch[i] = new FileSplitterFetch(siteInfoBean.getSSiteURL(), siteInfoBean.getSFilePath() + File.separator + siteInfoBean.getSFileName(), nStartPos[i],nEndPos[i],i); Utility.log("Thread " + i + " , nStartPos = " + nStartPos[i] + ", nEndPos = " + nEndPos[i]); fileSplitterFetch[i].start(); } // fileSplitterFetch[nPos.length-1] = new FileSplitterFetch(siteInfoBean.getSSiteURL(), siteInfoBean.getSFilePath() + File.separator + siteInfoBean.getSFileName(),nPos[nPos.length-1],nFileLength,nPos.length-1); // Utility.log("Thread " +(nPos.length-1) + ",nStartPos = "+nPos[nPos.length-1]+", nEndPos = " + nFileLength); // fileSplitterFetch[nPos.length-1].start(); // 絳夊緟瀛愮嚎紼嬬粨鏉? //int count = 0; // 鏄惁緇撴潫 while 寰幆 boolean breakWhile = false; while(!bStop) { write_nPos(); Utility.sleep(500); breakWhile = true; for(int i=0;i<nStartPos.length;i++) { if(!fileSplitterFetch[i].bDownOver) { breakWhile = false; break; } } if(breakWhile) break; //count++; //if(count>4) // siteStop(); } System.err.println("鏂囦歡涓嬭澆緇撴潫錛?); } catch(Exception e){e.printStackTrace ();} } // 鑾峰緱鏂囦歡闀垮害 public long getFileSize() { int nFileLength = -1; try{ URL url = new URL(siteInfoBean.getSSiteURL()); HttpURLConnection httpConnection = (HttpURLConnection)url.openConnection (); httpConnection.setRequestProperty("User-Agent","NetFox"); int responseCode=httpConnection.getResponseCode(); if(responseCode>=400) { processErrorCode(responseCode); return -2; //-2 represent access is error } String sHeader; for(int i=1;;i++) { //DataInputStream in = new DataInputStream(httpConnection.getInputStream ()); //Utility.log(in.readLine()); sHeader=httpConnection.getHeaderFieldKey(i); if(sHeader!=null) { if(sHeader.equals("Content-Length")) { nFileLength = Integer.parseInt(httpConnection.getHeaderField(sHeader)); break; } } else break; } } catch(IOException e){e.printStackTrace ();} catch(Exception e){e.printStackTrace ();} Utility.log(nFileLength); return nFileLength; } // 淇濆瓨涓嬭澆淇℃伅錛堟枃浠舵寚閽堜綅緗級 private void write_nPos() { try{ output = new DataOutputStream(new FileOutputStream(tmpFile)); output.writeInt(nStartPos.length); for(int i=0;i<nStartPos.length;i++) { // output.writeLong(nPos[i]); output.writeLong(fileSplitterFetch[i].nStartPos); output.writeLong(fileSplitterFetch[i].nEndPos); } output.close(); } catch(IOException e){e.printStackTrace ();} catch(Exception e){e.printStackTrace ();} } // 璇誨彇淇濆瓨鐨勪笅杞戒俊鎭紙鏂囦歡鎸囬拡浣嶇疆錛? private void read_nPos() { try{ DataInputStream input = new DataInputStream(new FileInputStream(tmpFile)); int nCount = input.readInt(); nStartPos = new long[nCount]; nEndPos = new long[nCount]; for(int i=0;i<nStartPos.length;i++) { nStartPos[i] = input.readLong(); nEndPos[i] = input.readLong(); } input.close(); } catch(IOException e){e.printStackTrace ();} catch(Exception e){e.printStackTrace ();} } private void processErrorCode(int nErrorCode) { System.err.println("Error Code : " + nErrorCode); } // 鍋滄鏂囦歡涓嬭澆 public void siteStop() { bStop = true; for(int i=0;i<nStartPos.length;i++) fileSplitterFetch[i].splitterStop(); } } |
/* **FileSplitterFetch.java */ package NetFox; import java.io.*; import java.net.*; public class FileSplitterFetch extends Thread { String sURL; //File URL long nStartPos; //File Snippet Start Position long nEndPos; //File Snippet End Position int nThreadID; //Thread's ID boolean bDownOver = false; //Downing is over boolean bStop = false; //Stop identical FileAccessI fileAccessI = null; //File Access interface public FileSplitterFetch(String sURL,String sName,long nStart,long nEnd,int id) throws IOException { this.sURL = sURL; this.nStartPos = nStart; this.nEndPos = nEnd; nThreadID = id; fileAccessI = new FileAccessI(sName,nStartPos); } public void run() { while(nStartPos < nEndPos && !bStop) { try{ URL url = new URL(sURL); HttpURLConnection httpConnection = (HttpURLConnection)url.openConnection (); httpConnection.setRequestProperty("User-Agent","NetFox"); String sProperty = "bytes="+nStartPos+"-"; httpConnection.setRequestProperty("RANGE",sProperty); Utility.log(sProperty); InputStream input = httpConnection.getInputStream(); //logResponseHead(httpConnection); byte[] b = new byte[1024]; int nRead; while((nRead=input.read(b,0,1024)) > 0 && nStartPos < nEndPos && !bStop) { nStartPos += fileAccessI.write(b,0,nRead); //if(nThreadID == 1) // Utility.log("nStartPos = " + nStartPos + ", nEndPos = " + nEndPos); } Utility.log("Thread " + nThreadID + " is over!"); bDownOver = true; //nPos = fileAccessI.write (b,0,nRead); } catch(Exception e){e.printStackTrace ();} } } // 鎵撳嵃鍥炲簲鐨勫ご淇℃伅 public void logResponseHead(HttpURLConnection con) { for(int i=1;;i++) { String header=con.getHeaderFieldKey(i); if(header!=null) //responseHeaders.put(header,httpConnection.getHeaderField(header)); Utility.log(header+" : "+con.getHeaderField(header)); else break; } } public void splitterStop() { bStop = true; } } /* **FileAccess.java */ package NetFox; import java.io.*; public class FileAccessI implements Serializable{ RandomAccessFile oSavedFile; long nPos; public FileAccessI() throws IOException { this("",0); } public FileAccessI(String sName,long nPos) throws IOException { oSavedFile = new RandomAccessFile(sName,"rw"); this.nPos = nPos; oSavedFile.seek(nPos); } public synchronized int write(byte[] b,int nStart,int nLen) { int n = -1; try{ oSavedFile.write(b,nStart,nLen); n = nLen; } catch(IOException e) { e.printStackTrace (); } return n; } } /* **SiteInfoBean.java */ package NetFox; public class SiteInfoBean { private String sSiteURL; //Site's URL private String sFilePath; //Saved File's Path private String sFileName; //Saved File's Name private int nSplitter; //Count of Splited Downloading File public SiteInfoBean() { //default value of nSplitter is 5 this("","","",5); } public SiteInfoBean(String sURL,String sPath,String sName,int nSpiltter) { sSiteURL= sURL; sFilePath = sPath; sFileName = sName; this.nSplitter = nSpiltter; } public String getSSiteURL() { return sSiteURL; } public void setSSiteURL(String value) { sSiteURL = value; } public String getSFilePath() { return sFilePath; } public void setSFilePath(String value) { sFilePath = value; } public String getSFileName() { return sFileName; } public void setSFileName(String value) { sFileName = value; } public int getNSplitter() { return nSplitter; } public void setNSplitter(int nCount) { nSplitter = nCount; } } /* **Utility.java */ package NetFox; public class Utility { public Utility() { } public static void sleep(int nSecond) { try{ Thread.sleep(nSecond); } catch(Exception e) { e.printStackTrace (); } } public static void log(String sMsg) { System.err.println(sMsg); } public static void log(int sMsg) { System.err.println(sMsg); } } /* **TestMethod.java */ package NetFox; public class TestMethod { public TestMethod() { ///xx/weblogic60b2_win.exe try{ SiteInfoBean bean = new SiteInfoBean("http://localhost/xx/weblogic60b2_win.exe", "L:\\temp","weblogic60b2_win.exe",5); //SiteInfoBean bean = new SiteInfoBean("http://localhost:8080/down.zip","L:\\temp", "weblogic60b2_win.exe",5); SiteFileFetch fileFetch = new SiteFileFetch(bean); fileFetch.start(); } catch(Exception e){e.printStackTrace ();} } public static void main(String[] args) { new TestMethod(); } } |
<%@ page contentType="text/html; charset=GBK" %>
<% response.setContentType("application/vnd.ms-excel;charset=GBK");
response.setHeader("Content-disposition","attachment; filename=test2.xls");
%>
<!--浠ヤ笅涓轟繚鎸佹垚html欏甸潰鐨別xcel鐨勫唴瀹?demo.html欏甸潰-->
<html xmlns:o="urn:schemas-microsoft-com:office:office"
xmlns:x="urn:schemas-microsoft-com:office:excel"
xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv=Content-Type content="text/html; charset=gb2312">
<meta name=ProgId content=Excel.Sheet>
<meta name=Generator content="Microsoft Excel 11">
<link rel=File-List href="qwe.files/filelist.xml">
<link rel=Edit-Time-Data href="qwe.files/editdata.mso">
<link rel=OLE-Object-Data href="qwe.files/oledata.mso">
<!--[if gte mso 9]><xml>
<o:DocumentProperties>
<o:Created>1996-12-17T01:32:42Z</o:Created>
<o:LastSaved>2010-05-12T13:59:04Z</o:LastSaved>
<o:Version>11.9999</o:Version>
</o:DocumentProperties>
<o:OfficeDocumentSettings>
<o:RemovePersonalInformation/>
</o:OfficeDocumentSettings>
</xml><![endif]-->
<style>
<!--table
{mso-displayed-decimal-separator:"\.";
mso-displayed-thousand-separator:"\,";}
@page
{margin:1.0in .75in 1.0in .75in;
mso-header-margin:.5in;
mso-footer-margin:.5in;}
tr
{mso-height-source:auto;
mso-ruby-visibility:none;}
col
{mso-width-source:auto;
mso-ruby-visibility:none;}
br
{mso-data-placement:same-cell;}
.style0
{mso-number-format:General;
text-align:general;
vertical-align:bottom;
white-space:nowrap;
mso-rotate:0;
mso-background-source:auto;
mso-pattern:auto;
color:windowtext;
font-size:12.0pt;
font-weight:400;
font-style:normal;
text-decoration:none;
font-family:瀹嬩綋;
mso-generic-font-family:auto;
mso-font-charset:134;
border:none;
mso-protection:locked visible;
mso-style-name:甯歌;
mso-style-id:0;}
td
{mso-style-parent:style0;
padding-top:1px;
padding-right:1px;
padding-left:1px;
mso-ignore:padding;
color:windowtext;
font-size:12.0pt;
font-weight:400;
font-style:normal;
text-decoration:none;
font-family:瀹嬩綋;
mso-generic-font-family:auto;
mso-font-charset:134;
mso-number-format:General;
text-align:general;
vertical-align:bottom;
border:none;
mso-background-source:auto;
mso-pattern:auto;
mso-protection:locked visible;
white-space:nowrap;
mso-rotate:0;}
ruby
{ruby-align:left;}
rt
{color:windowtext;
font-size:9.0pt;
font-weight:400;
font-style:normal;
text-decoration:none;
font-family:瀹嬩綋;
mso-generic-font-family:auto;
mso-font-charset:134;
mso-char-type:none;
display:none;}
-->
</style>
<!--[if gte mso 9]><xml>
<x:ExcelWorkbook>
<x:ExcelWorksheets>
<x:ExcelWorksheet>
<x:Name>Sheet1</x:Name>
<x:WorksheetOptions>
<x:DefaultRowHeight>285</x:DefaultRowHeight>
<x:CodeName>Sheet1</x:CodeName>
<x:Selected/>
<x:Panes>
<x:Pane>
<x:Number>3</x:Number>
<x:ActiveCol>1</x:ActiveCol>
</x:Pane>
</x:Panes>
<x:ProtectContents>False</x:ProtectContents>
<x:ProtectObjects>False</x:ProtectObjects>
<x:ProtectScenarios>False</x:ProtectScenarios>
</x:WorksheetOptions>
</x:ExcelWorksheet>
<x:ExcelWorksheet>
<x:Name>Sheet2</x:Name>
<x:WorksheetOptions>
<x:DefaultRowHeight>285</x:DefaultRowHeight>
<x:CodeName>Sheet2</x:CodeName>
<x:ProtectContents>False</x:ProtectContents>
<x:ProtectObjects>False</x:ProtectObjects>
<x:ProtectScenarios>False</x:ProtectScenarios>
</x:WorksheetOptions>
</x:ExcelWorksheet>
<x:ExcelWorksheet>
<x:Name>Sheet3</x:Name>
<x:WorksheetOptions>
<x:DefaultRowHeight>285</x:DefaultRowHeight>
<x:CodeName>Sheet3</x:CodeName>
<x:ProtectContents>False</x:ProtectContents>
<x:ProtectObjects>False</x:ProtectObjects>
<x:ProtectScenarios>False</x:ProtectScenarios>
</x:WorksheetOptions>
</x:ExcelWorksheet>
</x:ExcelWorksheets>
<x:WindowHeight>4530</x:WindowHeight>
<x:WindowWidth>8505</x:WindowWidth>
<x:WindowTopX>480</x:WindowTopX>
<x:WindowTopY>120</x:WindowTopY>
<x:AcceptLabelsInFormulas/>
<x:ProtectStructure>False</x:ProtectStructure>
<x:ProtectWindows>False</x:ProtectWindows>
</x:ExcelWorkbook>
</xml><![endif]-->
</head>
<body link=blue vlink=purple>
<table x:str border=0 cellpadding=0 cellspacing=0 width=288 style='border-collapse:
collapse;table-layout:fixed;width:216pt'>
<col width=72 span=4 style='width:54pt'>
<tr height=19 style='height:14.25pt'>
<td height=19 width=72 style='height:14.25pt;width:54pt'>鍏ㄧ悆</td>
<td width=72 style='width:54pt'>闂棶</td>
<td width=72 style='width:54pt'>ee</td>
<td width=72 style='width:54pt'>rr</td>
</tr>
<tr height=19 style='height:14.25pt'>
<td height=19 style='height:14.25pt'>鏆楁殫</td>
<td>ss</td>
<td>dd</td>
<td>ff</td>
</tr>
<![if supportMisalignedColumns]>
<tr height=0 style='display:none'>
<td width=72 style='width:54pt'></td>
<td width=72 style='width:54pt'></td>
<td width=72 style='width:54pt'></td>
<td width=72 style='width:54pt'></td>
</tr>
<![endif]>
</table>
</body>
</html>
涓枃闂錛?br />
鏌ョ湅婧愪唬鐮佹椂鍙戠幇JSP鏂囦歡涓啓姝葷殑涓枃涓轟貢鐮侊紝鍒欏湪JSP鏂囦歡澶撮儴娣誨姞涓琛?br />
<%@ page contentType="text/html; charset=gb2312" %>
鏌ョ湅婧愪唬鐮佹椂鍙戠幇鏂囧瓧涓轟腑鏂囷紝浣嗘槸鐢‥xcel鎵撳紑涓轟貢鐮佸垯鍦?lt;html>涓?lt;head>涓姞鍏?br />
<meta http-equiv="Content-Type" content="text/html; charset=GBK">
鍦╦sp欏甸潰涓紝瑕佸湪excel涓樉紺虹殑鍐呭鍙互浠庢暟鎹簱涓鍙栵紝鍦ㄦ灝變笉鍋氳緇嗙殑浠嬬粛浜?/p>
鎴戝湪web.xml涓緗?lt;welcome-file>HnSp/index.html</welcome-file>,鍙槸鍓嶅彴index.html
鑳芥樉紺哄嚭鏉ワ紝鍙槸欏甸潰涓殑鍥劇墖閮芥樉紺轟笉鍑烘潵錛坕ndex.html涓殑鍥劇墖鐨勮礬寰勯兘鏄敤鐨勭浉瀵硅礬
寰勶級錛屽悗鏉ュ湪鍙戠幇鏄劇ず鐨勯〉闈腑鐨勫浘鐗囧皯浜嗕竴綰э紝鍦ㄥ浘鐗囩殑璺緞鍓嶅姞鍏nSp灝辮兘姝g‘鏄劇ず浜?/p>
錛屽彲鏄湪鍒殑欏甸潰閫氳繃閾炬帴璁塊棶index.html欏甸潰錛屽浘鐗囪繕鏄樉紺轟笉鍑烘潵錛岀湅浜嗙煡閬擄紝澶氫簡涓?/p>
HnSp錛岀湅鏉ュ湪鍥劇墖鐨勮礬寰勫墠鍔犲叆HnSp鏄笉瀵圭殑錛?br /> 鎴戜竴鐩存兂涓嶆噦涓轟粈涔堬紝鍚庢潵鎯充簡涓姙娉曡В鍐充簡錛屽氨鏄湪WebRoot涓嬫柊寤轟竴涓柊鐨勭┖欏甸潰
MyJspjsp錛屽啓鍏ュ涓嬩唬鐮?<%response.sendRedirect("HnSp/index.html"); %>錛岀劧鍚庢妸
<welcome-file>HnSp/index.html</welcome-file>,鏀逛負<welcome-
file>MyJsp.jsp</welcome-file>,榪欐牱闂灝辮В鍐充簡錛岄兘涓嶅瓨鍦ㄨ礬寰勯敊璇棶棰樹簡錛?/p>
response.sendRedirect()
鏄湪鐢ㄦ埛鐨勬祻瑙堝櫒绔伐浣?sendRedirect()鍙互甯﹀弬鏁頒紶閫?姣斿servlet?name=frank浼犺嚦涓?/p>
涓〉闈?鍚屾椂瀹冨彲浠ラ噸瀹氬悜鑷充笉鍚岀殑涓繪満涓?sendRedirect()鍙互閲嶅畾鍚戞湁frame.鐨刯sp鏂囦歡.
閲嶅畾鍚戝悗鍦ㄦ祻瑙堝櫒鍦板潃鏍忎笂浼氬嚭鐜伴噸瀹氬悜欏甸潰鐨刄RL錛岀敱浜巖esponse鏄痡sp欏甸潰涓殑闅愬惈瀵硅薄
錛屾晠鍦╦sp欏甸潰涓彲浠ョ敤response.sendRedirect()鐩存帴瀹炵幇閲嶅畾浣嶃?br />