📄 mcinfo.jsp
字号:
<%@ page contentType="text/html; charset=GBK" language="java"%>
<%@ taglib prefix="c" uri="/WEB-INF/c.tld" %>
<%@ taglib prefix="fmt" uri="/WEB-INF/fmt.tld" %>
<c:if test="${mcList==null}">
<c:redirect url="/servlet/McInfoServlet" />
</c:if>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=GBK" />
<meta http-equiv="pragma" content="no-cache" />
<meta http-equiv="Cache-Control" content="no-cache, must-revalidate" />
<meta http-equiv="expires" content="Wed, 26 Feb 1970 08:21:57 GMT" />
<title>商品信息管理</title>
</head>
<link rel="stylesheet" href="/lmhshop/font/main.txt" type="text/css" >
<script language="javascript" type="text/javascript">
function mcManager(){
location.replace("<c:url value='/admin/mcManager/mcManager.jsp'/>");
}
function delMc(nid){
location.href="/lmhshop/servlet/McInfoServlet?action=delete&mcID="+nid;
}
<c:forEach var="maxMcBean" items="${mcTypeList}" >
<c:if test="${maxMcBean.npid==0}">
var ary_${maxMcBean.nid}=new Array();
</c:if>
<c:forEach items="${mcTypeList}" var="minMcBean">
<c:if test="${maxMcBean.nid==minMcBean.npid}">
ary_${maxMcBean.nid}[ary_${maxMcBean.nid}.length]="${minMcBean.nid};${minMcBean.sname}";
</c:if>
</c:forEach>
</c:forEach>
function selectType(){
var mySelect=window.document.getElementById("mySelect");
var selectObj=mySelect.options.value;
var myMin=window.document.getElementById("myMin");
myMin.options.length=0;
myMin.options.add(new Option("所有类别",""));
if(selectObj!=""){
var myAry=eval("ary_"+selectObj);
for(i=0;i<myAry.length;i++){
var op=myAry[i].indexOf(";");
var valuetObj=myAry[i].substring(0,op);
var textObj=myAry[i].substring(op+1);
var opObj=new Option(textObj,valuetObj);
myMin.options.add(opObj);
}
}
}
function updateMc(nid,smctag){
var mcIdObj=document.getElementById("mcID_"+nid);
var mcIdVal="";
if(mcIdObj!=""){
mcIdVal=mcIdObj.value;
}
if(mcIdVal!="是"&&mcIdVal!="否")
{
alert("输入含有非法字符,请输入‘是’或‘否’!");
if(mcIdObj!=""){
mcIdObj.value=smctag;
}
return false;
}else if(confirm("确认要修改缺货情况?")){
location.href="/lmhshop/servlet/McInfoServlet?action=update&mcID="+nid+"&smctag="+mcIdVal;
return true;
}
}
<!--分页处理-->
function submit(pageNum){
var pageValue=showForm.curPage.value;
if(pageNum==1){
pageValue=1;
}else if(pageNum==2&&pageValue>1){
pageValue--;
}else if(pageNum==3&&pageValue<${totalPage}){
pageValue++;
}else if(pageNum==4){
pageValue=${totalPage};
}
showForm.curPage.value=pageValue;
showForm.submit();
}
</script>
<body>
<c:if test="${empty mcList}">
<table width="100%" align="center">
<tr>
<td align="center">
<br>
<br>
<br>
<br>
<strong>对不起,暂无商品信息!请点<a href="#" onClick="mcManager();">添加商品</a></strong>
<br>
<br>
<br>
<br>
</td>
</tr>
</table>
</c:if>
<c:if test="${!empty mcList}">
<form method="get" action="/lmhshop/servlet/McInfoServlet" name="showForm">
<input type="hidden" id="curPage" name="curPage" value="${curPage}" />
<table width="100%">
<tr align="center">
<th width="5%" align="right" nowrap scope="row">
大类: </th>
<th width="16%" align="left" nowrap scope="row">
<select name="maxid" id="mySelect" onChange="selectType();">
<option value="">所有类别</option>
<c:forEach var="maxMcBean" items="${mcTypeList}" >
<c:if test="${maxMcBean.npid==0}">
<option value="${maxMcBean.nid}" ${maxMcBean.nid==param.maxid?"selected":""}>${maxMcBean.sname}</option>
</c:if>
</c:forEach>
</select> </th>
<th width="5%" align="right" nowrap scope="row">
小类: </th>
<th width="16%" align="left" nowrap scope="row">
<select name="minid" id="myMin">
<option value="">
所有类别 </option>
<!--让小类选中后刷新时不会变化-->
<c:forEach var="minMcBean" items="${mcTypeList}" >
<c:if test="${param.maxid!=0 && param.maxid==minMcBean.npid}">
<option value="${minMcBean.nid}" ${minMcBean.nid==param.minid?"selected":""}>${minMcBean.sname}</option>
</c:if>
</c:forEach>
</select> </th>
<th width="7%" align="right" nowrap scope="row">
关键字: </th>
<th width="7%" align="left" nowrap scope="row">
<input name="sname" type="text" id="sname" value="${param.sname}" size="10"> </th>
<th width="11%" align="right" nowrap scope="row">价格:</th>
<th width="16%" align="left" nowrap scope="row"> <input name="ptrstart" type="text" id="ptrstart" size="8" value="${param.ptrstart}">
至
<input name="ptrend" type="text" id="ptrend" size="8" value="${param.ptrend}"></th>
<th width="17%" nowrap scope="row">
<input name="Search" type="submit" id="Search" value="查询" />
<input type="button" name="addMc" id="addMc" value="添加商品" onClick="mcManager();" > </th>
</tr>
</table>
</form>
<table width="100%" border="1">
<tr>
<th width="17%" scope="row">图片</th>
<th width="22%" scope="row">商品名称</th>
<th width="20%" scope="row">单价</th>
<th width="23%" scope="row">是否缺货</th>
<th width="18%" scope="row">操作</th>
</tr>
<c:forEach items="${requestScope.mcList}" var="mcBean">
<tr>
<th scope="row"><img name="mcBean" src="../mcimg/${mcBean.simg}" width="62"
height="61"></th>
<th scope="row">${mcBean.sname}</th>
<th scope="row">¥${mcBean.nprice}</th>
<th scope="row">
<input id="mcID_${mcBean.nid}" name="mcID_${mcBean.nid}" type="text" value="${mcBean.smctag==1?'是':'否'}">
</th>
<th scope="row">
<c:if test="${mcBean.smctag==1}">
<a href="#" onClick="updateMc(${mcBean.nid},'是');" > 修改</a>
</c:if>
<c:if test="${mcBean.smctag==0}">
<a href="#" onClick="updateMc(${mcBean.nid},'否');" > 修改</a>
</c:if>
<a href="#" onClick="delMc(${mcBean.nid});return false;">删除 </a></th>
</tr>
</c:forEach>
</table>
<table width="100%" border="1">
<tr>
<td align="center" valign="middle">共有${countAll}条记录数
|
${curPage}/${totalPage}
|
<c:if test="${curPage!=1}">
<a href="#" onClick="submit(1);">首页</a>
<a href="#" onClick="submit(2);">上一页</a>
</c:if>
<c:if test="${curPage!=totalPage}">
<a href="#" onClick="submit(3);">下一页</a>
<a href="#" onClick="submit(4);">尾页</a>
</c:if>
</td>
</tr>
</table>
</c:if>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -