⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 administratoreditlist.jsp

📁 电子商务网站使用MVC模式B/S结构功能不是很全适合初学者看
💻 JSP
字号:
<%@ page contentType="text/html; charset=gb2312" language="java" import="java.util.*"  %>
<html>
<head>
<meta http-equiv="Content-Language" content="zh-cn">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>添加商品</title>
<style type="text/css">
<!--
.style1 {font-size: 12px}
-->
</style>
</head>
<%! String operate="";
%>
<%  

	operate=request.getParameter("operate");
	if(operate!=null){
		%>
		<script language="JavaScript">
		alert("操作成功");
		</script>
		<%
	}
	else{
		operate="";
	}
	
		String card="",num="",picture="",describe="",price="",restNum="";
		int id=0;
		if (session.getAttribute("table".toUpperCase())!=null){
			Hashtable table=(Hashtable)(session.getAttribute("table".toUpperCase()));
			card=table.get("card".toUpperCase()).toString();
			num=table.get("num".toUpperCase()).toString();
			picture=table.get("picture".toUpperCase()).toString();
			describe=table.get("describe".toUpperCase()).toString();
			price=table.get("price".toUpperCase()).toString();
			int i=price.indexOf(".");
			price=price.substring(0,i);
			restNum=table.get("restNum".toUpperCase()).toString();
			id=Integer.parseInt(table.get("id".toUpperCase()).toString());
			System.out.println("miaoshushi"+describe);
		}
	//out.print(session.getAttribute("sql"));
%>
<script language="javascript">
function document.onkeydown()
{
var e=event.srcElement;
if(event.keyCode==13)
{
document.getElementById("button").click();
return false;
}
}
</script>
	
<script language="JavaScript">
function checkImage(){
	pic=document.addListForm.picture.value;
	if (pic.indexOf(".jpg") > -1||pic.indexOf(".jpeg") > -1||pic.indexOf(".gif") > -1){
		fade(pic);		
		return true;
	}else{
		document.getElementById("ufspan").innerHTML = "<input name=\"picture\" type=\"file\" id=\"picture\" size=\"7\" accept=\"image/gif\" onChange=\"javascript:checkImage()\" >";
		alert("只能选择jpg或者gif图片");
	}

}
function checkDescribe(){
	pic=document.addListForm.describe.value;
	if (pic.indexOf(".htm") > -1||pic.indexOf(".html") > -1||pic.indexOf(".txt") > -1){
		return true;
	}else{									            
		document.getElementById("desc").innerHTML = "<input name=\"describe\" type=\"file\" id=\"describe\" size=\"7\" value=\"<%=describe%>\"  accept=\"html/htm/txt\" onChange=\"javascript:checkDescribe()\" >";
		alert("只能选择html或者htm或者txt文件");
	}
}

function checkData(){
	//检查姓名输入是否为空
	if(document.addListForm.num.value.length<1){
		alert("请输入手机型号.");
		document.addListForm.num.focus();
		return false;
	}
	
	if(document.addListForm.price.value.length<1){
		alert("请输入价格.");
		document.addListForm.price.focus();
		return false;
	}
	if(isNaN(parseInt(document.addListForm.price.value))){
		alert("价格必须是数字.");
		document.addListForm.price.focus();
		return false;
	}
	
	if(document.addListForm.picture.value==""){
		alert("图片地址还未填写");
		//document.addListForm.picture.value="<%=picture%>";
		return false;
	}
	
	//检查年龄
	if(document.addListForm.describe.value==""){
		alert("请输入说明.");
		//document.addListForm.describe.value="<%=describe%>";
		document.addListForm.describe.focus();
		return false;
	}
	addListForm.action="<%=request.getContextPath()%>/administratorEditListAction";
	addListForm.submit();
	return true;
}
function fade(imgurl){
	u.src=imgurl;
}

</script>


<body text="#990000" >
   <div align="center">
	<center>
	  <table width="698" border="1" align="center">
		<tr>
		  <td width="300" align="right">
            <img src="<%=request.getContextPath()%>/image/phone/<%=card%>/<%=num%>/<%=picture%>" name="u" width="302" height="376"> </td>
		  <td width="382" align="left" >
		  <form method="post" enctype="multipart/form-data"  name="addListForm" >
   <input type="hidden" name="id" value="<%=id%>" >	
<table width="94%" border="1" align="center">
			<tr>
			  <td width="38%" height="27"><div align="center" class="style1">手机品牌</div></td>
			  <td width="62%" ><div align="center">
				  <select name="card" size="1" id="select">
					<option value="nokia" selected>nokia</option>
					<option value="samsung">samsung</option>
					<option value="sony">sony</option>
					<option value="其他">其他........</option>
				  </select>
			  </div></td>
			</tr>
			<tr>
			  <td height="29" ><div align="center" class="style1">手机型号</div></td>
			  <td>
				<div align="center">
				  <input name="num" type="text" id="num2"  size="15" value="<%=num%>" >
			  </div></td>
			</tr>
			<tr>
			  <td ><div align="center" class="style1">手机类型</div></td>
			  <td>
				<div align="center">
				  <select name="model"  size="1" id="select2">
					<option value="直板" selected>直板</option>
					<option value="滑盖">滑盖</option>
					<option value="翻盖">翻盖</option>
					<option value="旋转">旋转</option>
					<option value="其他的">其他的......</option>
				  </select>
			  </div></td>
			</tr>
			<tr>
			  <td ><div align="center" class="style1">拍照功能</div></td>
			  <td>
				<div align="center">
				  <select name="photo" size="1" id="select3">
				    <option value="----没有----" selected>----没有----</option>
				    <option value="&lt;100">&lt;100</option>
				    <option value="100~200">100~200</option>
				    <option value="200~300">200~300</option>
				    <option value="&gt;300">&gt;300</option>
				  </select>
				</div>
				<div align="center"></div></td>
			</tr>
			<tr>
			  <td ><div align="center" class="style1">网络制式</div></td>
			  <td>
				<div align="center">
				  <select name="net" size="1" id="select4" >
					<option value="cdma" selected>cdma</option>
					<option value="gsm单频">gsm单频</option>
					<option value="gsm双频">gsm双频</option>
					<option value="gsm三频">gsm三频</option>
					<option value="其他">其他........</option>
				  </select>
				</div>
				<div align="center"></div></td>
			</tr>
			<tr>
			  <td ><div align="center" class="style1">价格</div></td>
			  <td><div align="center">
				  <input name="price" type="text" id="price2" size="15" value="<%=price%>" >
			  </div></td>
			</tr>
			<tr>
			  <td class="style1" ><div align="center">数量</div></td>
			  <td><div align="center">
				  <input name="restNum" type="text" id="restNum" size="15" value="<%=restNum%> ">
			  </div></td>
			</tr>
			<tr>
			  <td >
				<div align="center" class="style1">功能特点</div></td>
			  <td>
				<div align="center">
				  <select name="special" size="1">
					<option value="流媒体">流媒体......</option>
					<option value="蓝牙" selected>蓝牙</option>
					<option value="彩屏">彩屏</option>
					<option value="可换壳">可换壳</option>
					<option value="wap">wap</option>
					<option value="gprs">gprs</option>
					<option value="红外">红外</option>
					<option value="java">java</option>
					<option value="mms卡">mms卡</option>
					<option value="mp3">mp3</option>
					<option value="收音">收音</option>
					<option value="usb">usb</option>
				  </select>
				</div>
				<div align="center"></div></td>
			</tr>
			<tr>
			  <td ><div align="center" class="style1">图片地址</div></td>
			  <td><div align="center"> <span id="ufspan">
				  <input name="picture" type="file" id="picture" size="22" value="1.jpg"   accept="image/gif" onChange="javascript:checkImage()" >
			  </span> </div></td>
			</tr>
			<tr>
			  <td height="88"><div align="center" class="style1">其他说明</div></td>
			  <td><div align="center">
			    <span id="desc">
				  <input name="describe" type="file" id="describe" accept="html/htm/txt/doc" value="<%=describe%>" onChange="javascript:checkDescribe()" ><%=describe%>
			    </span>			  </div></td>
			</tr>
			<tr>
			  <td colspan=2>
				<div align="center">
				  <input name="button" type="button" id="button2" value="注册" onClick=checkData()>
&nbsp;
		<input name="reset" type="reset" id="reset2" value="重置">
&nbsp; </div>
			</tr>
		  </table>                                      
			</form></td>
		</tr>
</table>
									  
									  
</body>                                      
									  
</html>                                      

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -