jspSmartUpload的图片上传与更名Word格式文档下载.docx
《jspSmartUpload的图片上传与更名Word格式文档下载.docx》由会员分享,可在线阅读,更多相关《jspSmartUpload的图片上传与更名Word格式文档下载.docx(13页珍藏版)》请在冰豆网上搜索。
![jspSmartUpload的图片上传与更名Word格式文档下载.docx](https://file1.bdocx.com/fileroot1/2022-11/16/703b4a35-265e-45a4-8a0d-10e3e87d457a/703b4a35-265e-45a4-8a0d-10e3e87d457a1.gif)
varreq;
functionvalidate(){
varidField=document.getElementById("
userid"
);
varurl="
Validate.jsp?
id="
+escape(idField.value);
if(window.XMLHttpRequest){
req=newXMLHttpRequest();
}elseif(window.ActiveXObject){
req=newActiveXObject("
Microsoft.XMLHTTP"
}
req.open("
GET"
url,true);
req.onreadystatechange=callback;
req.send(null);
}
functioncallback(){
if(req.readyState==4){
if(req.status==200){
//alert(req.responseText);
varmsg=req.responseXML.getElementsByTagName("
msg"
)[0];
//alert(msg);
setMsg(msg.childNodes[0].nodeValue);
}
functionsetMsg(msg){
//alert(msg);
mdiv=document.getElementById("
usermsg"
if(msg=="
invalid"
){
mdiv.innerHTML="
fontcolor='
red'
usernameexists<
/font>
"
;
}else{
green'
congratulations!
youcanusethisusername!
/script>
metahttp-equiv="
Content-Type"
content="
text/html;
charset=gb2312"
styletype="
text/css"
--
a{text-decoration:
none;
color:
#000000}
a:
hover{text-decoration:
underline}
body{scrollbar-base-color:
#F3F6FA;
scrollbar-arrow-color:
#4D76B3;
font-size:
12px;
background-color:
#ffffff}
table{font:
12pxVerdana,Tahoma;
input,select,textarea{font:
11pxVerdana,Tahoma;
#000000;
font-weight:
normal;
#F3F6FA}
select{font:
.nav{font:
bold}
.nava{color:
.header{font:
#FFFFFF;
bold;
background-image:
url("
images/green/bg01.gif"
)}
.headera{color:
#FFFFFF}
.category{font:
#EFEFEF}
.tableborder{background:
border:
0pxsolid#4D76B3}
.singleborder{font-size:
0px;
line-height:
padding:
.smalltxt{font:
11pxVerdana,Tahoma}
.outertxt{font:
.outertxta{color:
.bold{font-weight:
.altbg1{background:
.altbg2{background:
-->
/style>
scriptlanguage="
JavaScript"
src="
images/common.js"
id="
defaultPopStyle"
.cPopText{font-family:
Tahoma,Verdana;
#FFFFCC;
1px#000000solid;
padding-right:
4px;
padding-left:
height:
20px;
padding-top:
2px;
padding-bottom:
visibility:
hidden;
filter:
Alpha(Opacity=80)}<
/head>
bodyleftmargin="
0"
rightmargin="
topmargin="
onkeydown="
if(event.keyCode==27)returnfalse;
divid="
popLayer"
style="
position:
absolute;
z-index:
1000;
class="
cPopText"
/div>
br>
<
tbody>
trvalign="
tdstyle="
border-top:
0pxnone;
border-right:
1pxnone;
9pt;
font-family:
Tahoma,Verdana;
rgb(0,0,0);
width="
100%"
tableborder="
cellpadding="
cellspacing="
tr>
/tr>
td>
tableid="
table3"
bgcolor="
#f3f6fa"
3"
/table>
/td>
/tbody>
formmethod="
post"
action="
server_productsAddDeal.jsp"
enctype="
multipart/form-data"
>
tableclass="
tableborder"
align="
center"
4"
1"
97%"
tdcolspan="
2"
header"
新商品上架<
tdclass="
altbg1"
21%"
商品名称:
altbg2"
inputname="
pro_name"
size="
25"
maxlength="
type="
text"
onblur="
validate()"
spanid="
/span>
商品价格:
pro_price"
元<
图片展示:
pic"
file"
center>
inputvalue="
提&
nbsp;
交"
submit"
/center>
/form>
--定位光标在username-->
document.register.username.focus();
/body>
/html>
2)编写处理图片上传的页面server_productsAddDeal.jsp
contentType="
charset=GBK"
%@pageimport="
java.sql.*"
com.web.shopping.util.*"
%>
--申明一个JavaBean-->
jsp:
useBeanid="
smartupload"
org.lxh.smart.SmartUpload"
/jsp:
useBean>
dbc"
com.web.system.db.DBUtil"
insert<
body>
%
request.setCharacter