📄 categoryform.jsp
字号:
<%@ page language="java" import="java.util.*,com.test.ps.category.*,com.test.ps.util.TransStr" pageEncoding="UTF-8"%>
<%
//读取上级分类
ArrayList<GoodsCategory> gcList=CategoryAction.getGoodsCategory();
Iterator<GoodsCategory> i=gcList.iterator();
String action = request.getParameter("action");
String selectValue="0";
if(request.getParameter("parentCate")!=null)
selectValue=request.getParameter("parentCate");
//判断页面类型
String isDis=request.getParameter("isDis");
String categoryNameValue=TransStr.transStr(request.getParameter("categoryNameValue"));
String parentCateValue=request.getParameter("parentCateValue");
String cateId=request.getParameter("cateId");
//跳转url
String url;
//提交处理
if(action!=null&& action.trim().equals("submit")){
GoodsCategory cate=new GoodsCategory();
cate.setCategoryName(TransStr.transStr(request.getParameter("categoryName")));
cate.setParentId(Integer.parseInt(selectValue));
CategoryAction cateAct=CategoryAction.category;
if(cateAct!=null){
//添加类别
if(categoryNameValue.equals("")){
cateAct.addCategory(cate);
}
//修改类别
else{
cateAct.changeCategory(Integer.parseInt(cateId),cate);
}
//提交后转向原分类列表
if(parentCateValue.equals("0")){
url="categoryManageParList.jsp";
}
else{
int parId=Integer.parseInt(selectValue);
url="categoryManageSonList.jsp?parId="+parId;
}
response.sendRedirect(url);
}
}
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>类别修改</title>
<LINK href="../img/adminStyle.css" type=text/css rel=stylesheet>
<script type="text/javascript">
//检查类别名是否为空
function checkIsEmpty(o,n)
{
var object=eval("err"+n);
if(o.value==""){
object.style.display="inline";
document.all.submit.disabled=true;
}
else {
object.style.display="none";
document.all.submit.disabled=false;
}
}
//设置页面类型(添加父类,子类或修改父类,子类)
function checkType(){
document.all.parentCate.disabled=<%=isDis%>;
document.all.categoryName.value="<%=categoryNameValue%>";
document.all.parentCate.value="<%=parentCateValue%>";
}
</script>
<style type="text/css">
<!--
.STYLE3 {color: #FF0000}
-->
</style>
<style type="text/css">
.STYLE2 {font-weight: bold}
</style>
</head>
<body onload="checkType()">
<table width="80%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="80" colspan="3">
<jsp:include page="../adminTop.jsp" flush="true"/></td>
</tr>
<tr>
<td colspan="3" height="30" bgcolor="#e6f3ff"><!-- InstanceBeginEditable name="EditRegion3" --><span class="STYLE2 STYLE2"><a href="../adminRight.jsp">首页</a>>编辑类别</span></td>
</tr>
<tr>
<td colspan="3" height="30"><hr size="5" color="#e6f3ff" /></td>
</tr>
<tr>
<td height="30"><h1>请填写类别信息</h1></td><!-- InstanceEndEditable -->
</tr>
<tr>
<td height="30" valign="top">
<form action="" method="post" name="catAddForm" id="catAddForm">
<input type="hidden" name="action" value="submit" />
<table width="75%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="41" height="40" valign="top"> </td>
<td width="83">类别名称</td>
<td width="148"><label>
<input type="text" name="categoryName" size="18" onblur="checkIsEmpty(this,1)" /> </label></td>
<td width="333"> *<div class="STYLE3" id="err1" style="display:none">名称不能为空</div></td>
</tr>
<tr>
<td valign="top"> </td>
<td valign="top"> </td>
<td valign="top"> </td>
<td> </td>
</tr>
<tr>
<td height="24" valign="top"> </td>
<td valign="top">上级分类</td>
<td valign="top"><label>
<select name="parentCate">
<option value="0">无</option>
<%while(i.hasNext()){
GoodsCategory cate=(GoodsCategory)i.next();%>
<option value="<%=cate.getCategoryId()%>"><%=cate.getCategoryName()%></option>
<%} %>
</select> </label></td>
<td> </td>
</tr>
<tr>
<td valign="top"> </td>
<td valign="top"> </td>
<td valign="top"> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td><label>
<input type="submit" name="submit" value="完成" disabled="disabled" />
</label></td>
<td> </td>
</tr>
</table>
</form>
<br />
</td>
</tr>
<tr>
<td><hr align="left" size="10" noshade color="#318EB7"></td>
</tr>
</table>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -