資源簡介
html5+jquery非常炫麗的登錄界面,包含登錄、注冊、修改密碼等效果

代碼片段和文件信息
/**
?*?
?*/
package?com.test.login;
import?java.io.File;
import?java.io.FileOutputStream;
import?java.io.IOException;
import?java.io.InputStream;
import?java.io.RandomAccessFile;
import?javax.servlet.ServletException;
import?javax.servlet.http.HttpServlet;
import?javax.servlet.http.HttpServletRequest;
import?javax.servlet.http.HttpServletResponse;
import?com.test.util.CodeToString;
/**
?*?@author?Administrator
?*
?*/
public?class?FileUploadServlet?extends?HttpServlet
{
/**
?*?
?*/
private?static?final?long?serialVersionUID?=?1L;
public?void?doPost(HttpServletRequest?requestHttpServletResponse?resp)throws?ServletExceptionIOException
{
resp.setContentType(“text;html;charset=utf-8“);
String?tempFileName?=?new?String(“tempFileName“);??
//tempfile?對象指向臨時文件??
File?tempFile?=?new?File(“D:/“+tempFileName);??
//outputfile?文件輸出流指向這個臨時文件??
FileOutputStream?outputStream?=?new?FileOutputStream(tempFile);??
//得到客服端提交的所有數據??
InputStream?fileSourcel?=?request.getInputStream();??
//將得到的客服端數據寫入臨時文件??
byte?b[]?=?new?byte[1000];??
int?n?;??
while?((n=fileSourcel.read(b))!=-1){??
????outputStream.write(b0n);??
}
//關閉輸出流和輸入流??
outputStream.close();??
fileSourcel.close();??
//randomFile對象指向臨時文件??
RandomAccessFile?randomFile?=?new?RandomAccessFile(tempFile“r“);??
//讀取臨時文件的第一行數據??
randomFile.readLine();??
//讀取臨時文件的第二行數據,這行數據中包含了文件的路徑和文件名??
String?filePath?=?randomFile.readLine();??
//得到文件名??
int?position?=?filePath.lastIndexOf(‘\\‘);??
String?filename?=?CodeToString.codeString(filePath.substring(positionfilePath.length()-1));??
//重新定位讀取文件指針到文件頭??
randomFile.seek(0);??
//得到第四行回車符的位置,這是上傳文件數據的開始位置??
long??forthEnterPosition?=?0;??
int?forth?=?1;??
while((n=randomFile.readByte())!=-1&&(forth<=4)){??
????if(n==‘\n‘){??
????????forthEnterPosition?=?randomFile.getFilePointer();??
????????forth++;??
????}??
}??
??
//生成上傳文件的目錄??
File?fileupLoad?=?new?File(“D:/work?space/JSP?workspace/jsp_servlet_upAndLoad/file““upLoad“);??
fileupLoad.mkdir();??
//saveFile?對象指向要保存的文件??
File?saveFile?=?new?File(“D:/work?space/JSP?workspace/jsp_servlet_upAndLoad/file/upLoad“filename);??
RandomAccessFile?randomAccessFile?=?new?RandomAccessFile(saveFile“rw“);??
//找到上傳文件數據的結束位置,即倒數第四行??
randomFile.seek(randomFile.length());??
long?endPosition?=?randomFile.getFilePointer();??
int?j?=?1;??
while((endPosition>=0)&&(j<=4)){??
????endPosition--;??
????randomFile.seek(endPosition);??
????if(randomFile.readByte()==‘\n‘){??
????????j++;??
????}??
}??
??
//從上傳文件數據的開始位置到結束位置,把數據寫入到要保存的文件中??
randomFile.seek(forthEnterPosition);??
long?startPoint?=?randomFile.getFilePointer();??
while(startPoint ????randomAccessFile.write(randomFile.readByte());??
????startPoint?=?randomFile.getFilePointer();??
}??
//關閉文件輸入、輸出??
randomAccessFile.close();
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件????????456??2015-08-19?15:45??jsp\.classpath
?????文件????????282??2017-03-07?16:39??jsp\.myme
?????文件???????1409??2015-08-11?09:24??jsp\.project
?????文件????????500??2015-08-11?09:23??jsp\.settings\.jsdtscope
?????文件????????330??2015-08-11?09:23??jsp\.settings\org.eclipse.jdt.core.prefs
?????文件?????????49??2015-08-11?09:23??jsp\.settings\org.eclipse.wst.jsdt.ui.superType.container
?????文件??????????6??2015-08-11?09:23??jsp\.settings\org.eclipse.wst.jsdt.ui.superType.name
?????文件???????3524??2015-08-13?10:21??jsp\src\com\test\login\FileUploadServlet.java
?????文件???????1169??2015-08-12?09:40??jsp\src\com\test\login\LoginServlet.java
?????文件????????546??2015-08-13?09:59??jsp\src\com\test\util\CodeToString.java
?????文件????????990??2015-08-20?09:45??jsp\WebRoot\css\iconfont.css
?????文件???????5728??2015-08-20?09:45??jsp\WebRoot\css\st
?????文件???????7504??2015-08-20?09:45??jsp\WebRoot\font\iconfont.eot
?????文件???????6495??2015-08-20?09:45??jsp\WebRoot\font\iconfont.svg
?????文件???????7220??2015-08-20?09:45??jsp\WebRoot\font\iconfont.ttf
?????文件???????4888??2015-08-20?09:45??jsp\WebRoot\font\iconfont.woff
?????文件??????59883??2015-08-20?09:45??jsp\WebRoot\images\banner.jpg
?????文件??????95700??2015-08-20?09:53??jsp\WebRoot\images\hsj.png
?????文件???????3208??2015-08-20?09:45??jsp\WebRoot\images\loading.gif
?????文件???????5120??2015-08-20?09:45??jsp\WebRoot\images\Thumbs.db
?????文件??????12217??2015-08-20?09:45??jsp\WebRoot\index.html
?????文件????????861??2015-08-12?09:36??jsp\WebRoot\index.jsp
?????文件??????94879??2015-08-20?09:49??jsp\WebRoot\js\jquery-1.7.2.min.js
?????文件???????3752??2015-08-13?10:50??jsp\WebRoot\jsp\accept.jsp
?????文件???????1790??2015-08-13?10:59??jsp\WebRoot\jsp\download.jsp
?????文件????????939??2015-08-13?10:21??jsp\WebRoot\jsp\fileUpload.jsp
?????文件???????1470??2015-08-13?09:21??jsp\WebRoot\jsp\getData.jsp
?????文件??????12213??2015-08-20?10:21??jsp\WebRoot\jsp\login.jsp
?????文件???????2324??2015-08-20?09:35??jsp\WebRoot\jsp\success.jsp
?????文件?????????36??2015-08-11?09:23??jsp\WebRoot\me
............此處省略32個文件信息
- 上一篇:靜態個人網站
- 下一篇:js 特效 html 特效 鼠標懸停變顏色
評論
共有 條評論