Rising Sun
BlogJava
::
首頁
::
新隨筆
::
聯(lián)系
::
聚合
::
管理
::
148 隨筆 :: 0 文章 :: 22 評論 :: 0 Trackbacks
<
2006年7月
>
日
一
二
三
四
五
六
25
26
27
28
29
30
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
1
2
3
4
5
常用鏈接
我的隨筆
我的評論
我的參與
最新評論
留言簿
(10)
給我留言
查看公開留言
查看私人留言
隨筆分類
cpp(3)
(rss)
css(6)
(rss)
hibernate+struts+spring(3)
(rss)
javascript(9)
(rss)
Lucene(3)
(rss)
oracle 數(shù)據(jù)庫(6)
(rss)
云計算(4)
(rss)
其它(6)
(rss)
處理Excel poi(6)
(rss)
學(xué)習(xí)總結(jié)(15)
(rss)
環(huán)境設(shè)置(2)
(rss)
隨筆檔案
2015年1月 (3)
2014年12月 (1)
2014年9月 (1)
2014年6月 (2)
2014年4月 (2)
2014年1月 (2)
2013年12月 (3)
2013年11月 (1)
2013年10月 (2)
2013年8月 (2)
2013年7月 (3)
2013年5月 (3)
2013年3月 (9)
2013年2月 (8)
2013年1月 (4)
2012年10月 (1)
2012年9月 (2)
2012年8月 (1)
2012年7月 (3)
2012年5月 (1)
2012年1月 (1)
2011年3月 (1)
2010年12月 (1)
2009年12月 (1)
2009年10月 (1)
2009年8月 (4)
2009年7月 (3)
2009年6月 (2)
2009年5月 (2)
2009年4月 (3)
2008年11月 (3)
2008年10月 (2)
2008年9月 (1)
2008年8月 (2)
2008年7月 (3)
2008年5月 (1)
2007年11月 (1)
2007年10月 (2)
2007年9月 (2)
2007年8月 (3)
2007年7月 (6)
2007年6月 (3)
2007年4月 (2)
2006年12月 (2)
2006年11月 (1)
2006年10月 (2)
2006年9月 (3)
2006年8月 (3)
2006年7月 (26)
2005年11月 (4)
相冊
我的相冊
java--->ajax
BlueDavy
http://www.aygfsteel.com/BlueDavy/
css
css
eamoi
搜索
最新評論
1.?re: request.getParameterValues與request.getParameter的區(qū)別:
5+5+
--5465
2.?re: 關(guān)于filter驗(yàn)證用戶權(quán)限
333
--12
3.?re: Gson通過借助TypeToken獲取泛型參數(shù)的類型的方法
博主如果解決了樓上的問題 請聯(lián)系我 萬分感謝 聯(lián)系方式QQ 474233979
--yueguangxuanyuan
4.?re: Gson通過借助TypeToken獲取泛型參數(shù)的類型的方法
評論內(nèi)容較長,點(diǎn)擊標(biāo)題查看
--yueguangxuanyuan
5.?re: CMS,全稱Concurrent Low Pause Collector gc[未登錄]
很有用。非常感謝!?。?!
--匿名
閱讀排行榜
1.?Gson通過借助TypeToken獲取泛型參數(shù)的類型的方法(42683)
2.?304 Not Modified狀態(tài)碼(18910)
3.?電腦非法關(guān)機(jī) 導(dǎo)致ORA-01033:解決方法(9096)
4.?struts2 -- interceptor(如何配置Interceptor) (7518)
5.?MYSQL在默認(rèn)的情況下查詢是不區(qū)分大小寫的(7361)
評論排行榜
1.?Gson通過借助TypeToken獲取泛型參數(shù)的類型的方法(6)
2.?Busy Developers' Guide to HSSF Features (說明書)(3)
3.?對于網(wǎng)上看到Window.Open()傳值(3)
4.?excel 處理 Poi(1)
5.?關(guān)于filter驗(yàn)證用戶權(quán)限(1)
JSP處女作:commons-fileupload-1.0.jar + Oracle數(shù)據(jù)庫文件上傳
<!--$Header:?ProcessFileUpload.jsp?1.0.0?2004/10/22?15:10:19?pkm?ship??$-->
<%@?page?contentType=
"text/html;charset=GB2312"
%>
<%@?page?
import
=
"org.apache.commons.
fileupload
.DiskFileUpload"
%>
<%@?page?
import
=
"org.apache.commons.
fileupload
.FileItem"
%>
<%@?page?
import
=
"java.util.*"
%>
<%@?page?
import
=
"java.io.File"
%>
<%@?page?
import
=
"java.sql.*"
?%>
<html>
<head>
<style>
.NButton
{
????cursor:hand;
????width:?87px;
????height:?20px;
????font-family:?宋體;
????font-size:?12px;
????text-align:center?;
????background-image:?url(btn_bkg.gif);
????border:0px;
}
</style>
<%!
//?Connect?to?Oracle?database?and?Insert?into?cux_upload_files
public
?
void
?dbInsert(
String
?p_c_file_name,
String
?p_c_path,
String
?p_s_file_name,
String
?p_s_path)?{
????
Connection
?conn?=?
null
;
????
String
?connStr;
??
try
?{
????connStr=
"jdbc:oracle:thin:@local:1521:orcl"
;
????
DriverManager
.registerDriver(
new
?oracle.jdbc.driver.OracleDriver());
????conn?=?
DriverManager
.getConnection(connStr,
"apps"
,?
"apps"
);
????
//?Insert?into?table
????conn.setAutoCommit(
false
);?
????
PreparedStatement
?insertCUF?=?conn.prepareStatement(
"INSERT?INTO?cux.cux_upload_files(file_id,client_file_name,client_path,server_file_name,server_path,created_by,creation_date)?"
????+?
"?VALUES?(cux.cux_upload_files_s.nextval,?,?,?,?,?,SYSDATE)?"
);
??
????
//insertCUF.setInt(1,2);
????insertCUF.setString(1,p_c_file_name);
????insertCUF.setString(2,p_c_path);
????insertCUF.setString(3,p_s_file_name);
????insertCUF.setString(4,p_s_path);
????insertCUF.setString(5,
"XXX"
);
????insertCUF.executeUpdate();
??
????conn.commit();
??
????conn.setAutoCommit(
true
);
??
????conn.close();
??}
catch
(
SQLException
?ex)?{?
//?Handle?SQL?errors
??????
System
.out.println(
"Error?in?Connecting?to?the?Database?"
+'\n'+ex.toString());
??}
}
//
String
?getCurDate(){
????
GregorianCalendar
?gcDate?=?
new
?
GregorianCalendar
();?
????
int
?year??=?gcDate.get(
GregorianCalendar
.YEAR);
????
int
?month?=?gcDate.get(
GregorianCalendar
.MONTH);
????
int
?day???=?gcDate.get(
GregorianCalendar
.DAY_OF_MONTH);
????
return
?
""
?+?year?+?
"-"
?+?month?+?
"-"
?+?day;
}
%>
<meta?http-equiv=
"Content-Type"
?content=
"text/html;?charset=gb2312"
?>
<title>
Process
?
File
?Upload</title>
</head>
<body>
<table?width=
"800"
?border?bordercolor=
"#0000FF"
>
<tr?bgcolor=
"#66CCFF"
>
<td?colspan=1?rowspan=1?align=left?valign=top>
????<strong><font?size=2?face=
"宋體"
?color=#000000>
????<nobr>客戶端文件</nobr>
????</font>
????</strong></td>
<td?colspan=1?rowspan=1?align=left?valign=top>
????<strong><font?size=2?face=
"宋體"
?color=#000000>
????<nobr>服務(wù)器文件</nobr>
????</font>
????</strong></td>
<td?colspan=1?rowspan=1?align=left?valign=top>
????<strong><font?size=2?face=
"宋體"
?color=#000000>
????<nobr>上傳用戶</nobr>
????</font>
????</strong></td>
</tr>
<%
????
//out.println("Content?Type?="+request.getContentType());
????
????DiskFileUpload?fu?=?
new
?DiskFileUpload();
????
//?If?file?size?exceeds,?a?FileUploadException?will?be?thrown
????fu.setSizeMax(1000000);
????
//?maximum?size?that?will?be?stored?in?memory
????fu.setSizeThreshold(4096);
????
//?the?location?for?saving?data?that?is?larger?than?getSizeThreshold()
????
//fu.setRepositoryPath("/tmp/");
????
????
????
List
?fileItems?=?fu.parseRequest(request);
????
Iterator
?itr?=?fileItems.iterator();
????
int
?i?=?0;
??
????
while
(itr.hasNext())?{
??????FileItem?fi?=?(FileItem)itr.next();
??????i++;
??????
//Check?if?not?form?field?so?as?to?only?handle?the?file?inputs
??????
//else?condition?handles?the?submit?button?input
??????
if
?(!fi.isFormField())?{
????????????
String
?filename?=?fi.getName();
????????????
long
?filesize?=?fi.getSize();
??????
String
?pUserName?=?
"XIAOHUIPING"
;
????????????
if
((filename==
null
||filename.equals(
""
))?&&?filesize==0)
????????????
continue
;
????????????
//?注意fi.getName()
????????????
//?會返回上載文件在客戶端的完整路徑名稱,這似乎是一個BUG。
????????????
//?為解決這個問題,這里使用了fullFile.getName()。
????????????filename=filename.replace('\\','/');
????????????
//new?String(filename.getBytes("ISO-8859-1"),"UTF-8");
????????????
File
?fullFile?=?
new
?
File
(filename);
????????????
//?指定fullFile.getName()?=?"Works.txt";
????????????
File
?savedFile=?
new
?
File
(application.getRealPath(
"/Download/"
),?fullFile.getName());
????????????fi.write(savedFile);
????????????
//?上傳文件成功后寫入數(shù)據(jù)庫表
????????????dbInsert(fullFile.getName(),filename.replace('/','\\'),fullFile.getName(),savedFile.getAbsolutePath());
??????
if
?((i%2)?==?0)?{
????????????
//?文件上載成功提示,以表格形式打印
??????out.println(
"<tr?bgcolor=\"#CCCCCC\"><td?colspan=1?rowspan=1?align=left?valign=top><font?size=2?face=\"宋體\"?color=#000000><nobr>"
?+?fullFile.getName()?+?
"</nobr></font></td><td?colspan=1?rowspan=1?align=left?valign=top><font?size=2?face=\"宋體\"?color=#000000><nobr>"
?+?fullFile.getName()?+?
"</nobr></font></td><td?colspan=1?rowspan=1?align=left?valign=top><font?size=2?face=\"宋體\"?color=#000000><nobr>"
?+?pUserName?+?
"</nobr></font></td></tr>"
);
????????????
//out.println("<br>"?+?"Local?Filename?=?"?+?"\""?+?filename.replace('/','\\')?+?"\""?+?"?Upload?To?\""??+?savedFile.getAbsolutePath()?+?"\""?+?"?Successful!!");
????????????}
??????
else
?
if
?((i%2)?==?1)?{
??????out.println(
"<tr><td?colspan=1?rowspan=1?bgcolor=#ffffff?align=left?valign=top><font?size=2?face=\"宋體\"?color=#000000><nobr>"
?+?fullFile.getName()?+?
"</nobr></font></td><td?colspan=1?rowspan=1?bgcolor=#ffffff?align=left?valign=top><font?size=2?face=\"宋體\"?color=#000000><nobr>"
?+?fullFile.getName()?+?
"</nobr></font></td><td?colspan=1?rowspan=1?bgcolor=#ffffff?align=left?valign=top><font?size=2?face=\"宋體\"?color=#000000><nobr>"
?+?pUserName?+?
"</nobr></font></td></tr>"
);
??????}
??????}
????}
%>
</table>
<table?width=
"800"
?border?bordercolor=
"#0000FF"
>
??<tr>
????<td?height=
"20"
?align=
"center"
?nowrap=
"nowrap"
>
??????<DIV?align=
"center"
>
????????<input?
class
=
"NButton"
?type=
"button"
?value=
"Back"
?onClick=
"javascript:history.back()"
/>
????????<input?
class
=
"NButton"
?type=
"button"
?value=
"Close"
?onClick=
"javascript:window.close()"
/>
??????</DIV>
????</td>
??</tr>
</table>
</body>
</html>
<!--$Header:?index.jsp?1.0.0?2004/10/22?15:10:19?pkm?ship??$-->
<%@?page?contentType?=?
"text/html;charset=gb2312"
?%>
<html>
<head>
<title>數(shù)據(jù)文件上傳</title>
<style>
BODY
{
??FONT-FAMILY:?宋體;
??FONT-SIZE:?10pt;
????background-color:?#F6F6F6;
????margin-top:?10px;
????margin-right:?50px;
????margin-bottom:?50px;
????margin-left:?10px;
????margin-top:?0px
????SCROLLBAR-FACE-COLOR:?#D0E5FF;
????SCROLLBAR-HIGHLIGHT-COLOR:?#F5F9FF;
????SCROLLBAR-SHADOW-COLOR:?#828282;
????SCROLLBAR-3DLIGHT-COLOR:?#828282;
????SCROLLBAR-ARROW-COLOR:?#797979;
????SCROLLBAR-TRACK-COLOR:?#ECECEC;
????SCROLLBAR-DARKSHADOW-COLOR:?#ffffff
}
TABLE
{
??FONT-FAMILY:?宋體;
??FONT-SIZE:?10pt
}
.HeaderTitle{
????font-family:?黑體;
????font-size:?30px;
????font-weight:?bolder;
????color:?#041986;
}
.TitleBar
{
??BACKGROUND-COLOR:?#E5EAED;
??
Color
:#565656;
??FONT-FAMILY:?宋體;
??font-weight:bold;
??FONT-SIZE:?11pt;
}
.TextBox
{
????FONT-FAMILY:?宋體;
????FONT-SIZE:?10pt;
????height:?20px;
????BORDER-BOTTOM:?1pt?solid?#C6C6C6;
????BORDER-LEFT:?1pt?solid?#C6C6C6;
????BORDER-RIGHT:?1pt?solid?#C6C6C6;
????BORDER-TOP:?1pt?solid?#C6C6C6;
}
.InputGridTable{
??FONT-FAMILY:?宋體;
??FONT-SIZE:?10pt;
????border-collapse:?collapse;
????border-color:#C6C6C6;
????border-style:?solid;
????border-width:?1;
????padding:?0;
}
.TitleColumn{
????background-color:?#E8ECF0;
????nowrap=
"nowrap"
;
??HEIGHT:?20px
}
.NButton
{
????cursor:hand;
????width:?87px;
????height:?20px;
????font-family:?宋體;
????font-size:?12px;
????text-align:center?;
????background-image:?url(btn_bkg.gif);
????border:0px;
}
</style>
<script?language=
"javascript"
>
var?count?=?1;
function?delAttacheFile(){
????var?targetRow?=?event.srcElement.parentElement.parentElement;
????InputTable.deleteRow(targetRow.rowIndex);
}
function?addAttacheFile(){
????count?++;
????var?row?=?InputTable.insertRow(InputTable.rows.
length
);
????var?firstCell?=?row.insertCell(0);
????firstCell.className?=?
"TitleColumn"
;
????firstCell.width?=?
"10%"
;
????firstCell.height?=?
"20"
;
????firstCell.innerHTML?=?
"<strong>?附件?"
?+?count+?
"?:</strong>"
;
????var?lastCell?=?row.insertCell(1);
????lastCell.height?=?
"20"
;
????lastCell.innerHTML?=?
"<input?type='file'?name='attacheFile"
?+?count?+?
"'?size='50'?class='TextBox'>?<input?type='button'?value='刪除附件?"
?+?count?+?
"'?onclick='delAttacheFile();'?class='NButton'>"
;
}
</script>
</head>
<body>
??<form?name=
"filesForm"
?method=
"POST"
?action=
"ProcessFileUpload.jsp"
?enctype=
"multipart/form-data"
>
????<table?id=
"InputTable"
?border=
"1"
?cellpadding=
"0"
?cellspacing=
"0"
?
class
=
"InputGridTable"
?width=
"100%"
?height=
"40"
?>
??????<tr>
????????<td?nowrap=
"nowrap"
?height=
"20"
?colspan=
"3"
?
class
=
"TitleColumn"
><div?align=
"center"
><strong>附件列表:</strong></div></td>
??????</tr>
??????<tr>
????????<td?nowrap=
"nowrap"
?width=
"10%"
?height=
"20"
?
class
=
"TitleColumn"
><strong>附件?1?:</strong></td>
????????<td?height=
"20"
?nowrap=
"nowrap"
><input?type=
"file"
?
class
=
"TextBox"
?name=
"attacheFile1"
?size=
"50"
>?<input?name=
"adfile"
?type=
"button"
?
class
=
"NButton"
?onClick=
"addAttacheFile();"
?value=
"添加附件"
></td>
??????</tr>
????</table>
????<table?id=
"SubmitTable"
?border=
"1"
?cellpadding=
"0"
?cellspacing=
"0"
?
class
=
"InputGridTable"
?width=
"100%"
?height=
"20"
?>
??????<tr>
????????<td?height=
"20"
?align=
"center"
?nowrap=
"nowrap"
>
??????????<input?type=
"submit"
?name=
"close"
?value=
"Close"
?onClick=
"self.close();"
?
class
=
"NButton"
/>
??????????<input?type=
"reset"
?name=
"reset"
?value=
"Clear"
?
class
=
"NButton"
/>
??????????<input?type=
"submit"
?name=
"Submit"
?value=
"Upload"
?
class
=
"NButton"
/>?
????????</td>
??????</tr>
????</table>
??</form>
????<p>?</p>
</body>
</html>
posted on 2006-07-13 16:32
brock
閱讀(610)
評論(0)
編輯
收藏
新用戶注冊
刷新評論列表
只有注冊用戶
登錄
后才能發(fā)表評論。
網(wǎng)站導(dǎo)航:
博客園
IT新聞
Chat2DB
C++博客
博問
管理
Powered by:
BlogJava
Copyright © brock
主站蜘蛛池模板:
胶州市
|
顺昌县
|
德昌县
|
德阳市
|
平度市
|
中超
|
定陶县
|
黔江区
|
太原市
|
百色市
|
措勤县
|
平乡县
|
安图县
|
珲春市
|
汶上县
|
河源市
|
合川市
|
潮安县
|
乌海市
|
固安县
|
白河县
|
南川市
|
鄂伦春自治旗
|
伊吾县
|
西畴县
|
巫山县
|
鸡泽县
|
德钦县
|
襄垣县
|
仁怀市
|
文水县
|
枣庄市
|
洪洞县
|
无棣县
|
钦州市
|
营山县
|
兴义市
|
青龙
|
元江
|
迭部县
|
庆阳市
|