?? goodscategorychoose.jsp
字號:
<%@ page language="java" import="java.util.*,com.test.ps.category.*" pageEncoding="UTF-8"%>
<%
int cateId=Integer.parseInt(request.getParameter("categoryId"));
int parId=Integer.parseInt(request.getParameter("parentId"));
ArrayList<GoodsCategory> gcList=CategoryAction.getGoodsCategory();
Iterator<GoodsCategory> iPar=gcList.iterator();
ArrayList<GoodsCategory> gcSonList=CategoryAction.getSonGoodsCategory(parId);
Iterator<GoodsCategory> iSon=gcSonList.iterator();
%>
<html>
<head>
<LINK href="../img/adminStyle.css" type=text/css rel=stylesheet>
<title>選擇類別</title>
<script type="text/javascript">
//初始化類別下拉列表
function initCate()
{
document.all.parentCate.value="<%=parId%>";
document.all.sonCate.value="<%=cateId%>";
}
//二級下拉列表更新
function updateSonCate(o)
{
window.location.href="goodsCategoryChoose.jsp?categoryId=0&parentId="+o.value;
}
//檢查類別
function checkCate()
{
if(document.all.parentCate.value=="0"||document.all.sonCate.value=="0"){
alert("商品類別不能為空");
}
else{
window.location.href="goodsAdd.jsp?categoryId="+document.all.sonCate.value+"&parId="
+document.all.parentCate.value;
}
}
</script>
<style type="text/css">
<!--
.STYLE1 {font-weight: bold}
-->
</style>
</head>
<body onload="initCate()">
<form name="goodsAdd" method="post" action="">
<table width="80%" border="0" align="left" cellpadding="0" cellspacing="0">
<tr>
<td height="80" colspan="3">
<jsp:include page="../adminTop.jsp" flush="true"/></td>
</tr>
<tr>
<td colspan="3" height="30" bgcolor="#e6f3ff"><span class="STYLE1"><a href="../adminMain.jsp">首頁</a>>添加商品</span></td>
</tr>
<tr>
<td colspan="3" height="30"><hr size="5" color="#e6f3ff"></td>
</tr>
<tr>
<td colspan="3" height="20"><h1>請先選擇所屬品牌及型號</h1></td>
</tr>
<tr>
<td width="152" height="30"><div align="center">選擇類別:</div></td>
<td width="120"><label>
<select name="parentCate" onchange=updateSonCate(this)>
<option value=0>選擇品牌</option>
<%
while(iPar.hasNext()){
GoodsCategory cate=(GoodsCategory)iPar.next();
%>
<option value="<%=cate.getCategoryId()%>"><%=cate.getCategoryName()%></option>
<% }%>
</select>
</label></td>
<td width="546"><select name="sonCate">
<option value=0>選擇型號</option>
<%
if(parId!=0){
while(iSon.hasNext()){
GoodsCategory cateS=(GoodsCategory)iSon.next();
%>
<option value="<%=cateS.getCategoryId()%>"><%=cateS.getCategoryName()%></option>
<% }
}%>
</select></td>
</tr>
<tr>
<td height="40" valign="middle"> </td>
<td valign="middle"><label>
<input type="button" name="Submit" value="下一步" onClick=checkCate()>
</label></td>
<td valign="middle"> </td>
</tr>
<tr>
<td height="30" colspan="3" valign="middle"><hr size="5" color="#e6f3ff"></td>
</tr>
<tr>
<td colspan="3"><hr align="left" size="10" noshade color="#318EB7"></td>
</tr>
</table>
</form>
</body>
</html>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -