📄 produittemp.jsp
字号:
<%@ page language="java" import="java.util.*" pageEncoding="GB2312"%>
<jsp:directive.page import="com.captainli.dboperation.ProduitDA"/>
<jsp:directive.page import="com.captainli.bean.ProduitBean"/>
<jsp:directive.page import="com.captainli.dboperation.BigclassDA"/>
<jsp:directive.page import="com.captainli.bean.BigclassBean"/>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>My JSP 'produit.jsp' starting page</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<link rel="stylesheet" type="text/css" href="../css/sys.css">
<style type="text/css">
<!--
body {
margin-left: 5px;
margin-top: 5px;
margin-right: 5px;
margin-bottom: 5px;
background-color: #FFFFFF;
}
a:link {
color: #1A438E;
text-decoration: underline;
}
a:visited {
text-decoration: underline;
}
a:hover {
text-decoration: none;
color: #000000;
}
a:active {
text-decoration: underline;
}
.style1 { color: #1A438E;
font-size: 12px;
}
.style2 { color:#FF0000;
font-size: 12px;
}
-->
</style>
<script type="text/javascript" language="javascript">
var http_request = false;
function createRequest(url) {
//初始化对象并发出XMLHttpRequest请求
http_request = false;
if (window.XMLHttpRequest) { // Mozilla或其他除IE以外的浏览器
http_request = new XMLHttpRequest();
if (http_request.overrideMimeType) {
http_request.overrideMimeType("text/xml");
}
} else if (window.ActiveXObject) { // IE浏览器
try {
http_request = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
http_request = new ActiveXObject("Microsoft.XMLHTTP");
} catch (e) {}
}
}
if (!http_request) {
alert("不能创建XMLHTTP实例!");
return false;
}
http_request.onreadystatechange = alertContents; //指定响应方法
//发出HTTP请求
http_request.open("GET", url, true);
http_request.setRequestHeader("If-Modified-Since","0");
http_request.send(null);
}
function alertContents() { //处理服务器返回的信息
if (http_request.readyState == 4) {
if (http_request.status == 200) {
pscid.innerHTML=http_request.responseText;
} else {
alert('您请求的页面发现错误');
}
}
}
</script>
<script type="text/javascript" language="javascript">
function F_super(){
var pbcid = document.getElementById("p_bc_id").value;
//window.location.href="produit.jsp?p_bc_id="+pbcid+"";
createRequest("../utilPages/produit_selectSmallclass_ajax.jsp?p_bc_id="+pbcid); //实现级联下拉列表
}
</script>
</head>
<%
int p_bc_id = 0;//大类
int p_sc_id = 0;//小类
ArrayList arryPro = null;
if(request.getParameter("p_bc_id") != null){//大类传值了
if(request.getParameter("p_sc_id") != null){//小类传值了
if(request.getParameter("p_sc_id").toString().equals("0")){//小类没有选择。通过大类ID返回所有产品的arraylist
p_bc_id = Integer.parseInt(request.getParameter("p_bc_id"));
arryPro = new ProduitDA().showProduitBc(p_bc_id);
}else{
p_sc_id = Integer.parseInt(request.getParameter("p_sc_id"));
arryPro = new ProduitDA().showProduitSc(p_sc_id);
}
}else{//小类没传值,通过大类ID返回所有产品的arraylist
p_bc_id = Integer.parseInt(request.getParameter("p_bc_id"));
arryPro = new ProduitDA().showProduitBc(p_bc_id);
}
}else{//大类没传值
arryPro = new ProduitDA().showProduit();
}
%>
<%
int intPageSize; //一页显示的记录数
int intRowCount; //记录总数
int intPageCount;//总页数
int intPage; //待显示页码
String strPage; //请求页码
//设置一页显示的记录数
intPageSize = 10;
//取得显示的页码
strPage = request.getParameter("page");
if(strPage == null){//刚打开网页的时候,表明没有参数,此时显示第1页数据
intPage = 1;
}
else{//将字符串转换成整型
intPage = Integer.parseInt(strPage);
//if(intPage <= 1)
// intPage = 1;
}
//获取记录总数
intRowCount = arryPro.size();
//记算总页数
intPageCount = (intRowCount + intPageSize-1) / intPageSize;
int startNum = (intPage - 1) * intPageSize;//当前页起始索引
int endNum = startNum + intPageSize;//当前页结束索引
if(endNum >= arryPro.size()){
endNum = arryPro.size();
}
%>
<%
ArrayList arryBigclass = new BigclassDA().selectBigClass();//大类
%>
<body>
<table width="100%" border="0" cellpadding="0" cellspacing="2" align="center">
<tr>
<td width="25%" align="left"><span class="style1">请选择药品大类:</span>
<select name="p_bc_id" id="p_bc_id" onChange="F_super()">
<option value="0">--请选择药品大类--</option><%
for(int i = 0;i < arryBigclass.size();i++){
BigclassBean bean = (BigclassBean)arryBigclass.get(i);
%>
<option value="<%= bean.getBc_id() %>" <%if(p_bc_id == bean.getBc_id()){ %>selected="selected"<%} %>><%= bean.getBc_name() %></option>
<%} %>
</select>
</td>
<td width="10%" align="left"><div align="right"><span class="style1">请选择药品小类:</span></div></td>
<td width="20%" height="30" id="pscid" align="left">
<select name="p_sc_id" id="p_sc_id">
<option>--请选择药品小类--</option>
</select>
</td>
<td width="5%" align="left"> </td>
<td width="40%" align="left"> </td>
</tr>
</table>
<table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#C4D8ED">
<tr>
<td><img src="../images/system/r_1.gif" alt="" width="6" height="27" /></td>
<td width="100%" background="../images/system/r_0.gif"><table cellpadding="0" cellspacing="0" width="100%">
<tr>
<td> <span class="style1">修改 / 删除药品资料</span></td>
<td align="right"><input type="button" value="添加药品资料" onClick="window.location.href='produit_add.jsp'" class="button"> <input type="button" value="药品起初库存" onClick="window.location.href='produit_warehouse.jsp'" class="button">
</td>
</tr>
</table></td>
<td><img src="../images/system/r_2.gif" alt="" width="6" height="27" /></td>
</tr>
<tr>
<td></td>
<td><form name="form1" action="user_del.jsp">
<table align="center" cellpadding="4" cellspacing="1" class="toptable grid" border="1">
<tr align="center">
<td width="37%" height="30" class="category">药品全名</td>
<td width="20%" class="category">所属药品大类</td>
<td width="20%" class="category">所属药品小类</td>
<td width="10%" class="category">计量单位</td>
<td width="8%" class="category">修改</td>
<td width="5%" class="category">删除</td>
</tr>
<%
for(int i = startNum;i < endNum;i++){
ProduitBean bean = (ProduitBean)arryPro.get(i);//一行
%>
<tr onMouseOver="this.className='highlight'" onMouseOut="this.className=''" onDblClick="javascript:var win=window.open('produit_show.jsp?pid=<%= bean.getP_id() %>','药品详细信息','width=853,height=470,top=176,left=161,toolbar=no,location=no,directories=no,status=no,menubar=no,resizable=no,scrollbars=yes'); win.focus()">
<td align="center" height="25"><%= bean.getP_name() %></td>
<td align="center"><%= bean.getBc_name() %></td>
<td align="center"><%= bean.getSc_name() %></td>
<td align="center"><%= bean.getP_unit() %></td>
<td align="center"><a href="produit_update.jsp?pid=<%= bean.getP_id() %>"><img src="../images/system/res.gif" width="25" height="19" hspace="2" border="0" align="absmiddle">修改</a></td>
<td align="center"><input type="checkbox" name="shanchu" id="shanchu" value="<%= bean.getP_id() %>" style="border:0"></td>
</tr><%} %>
<tr>
<td colspan="6" height="30" class="category"><table align="center">
<tr>
<td> 第<%= intPage%>页 共<%= intPageCount%>页
<% //以下是分页的“上一页”“下一页”,有上一页就有链接,没有就为文字,下一页同理 %>
<% if(intPage > 1){ %>
<a href="produit.jsp?page=<%= intPage-1%>&p_bc_id=<%= p_bc_id %>&p_sc_id=<%= p_sc_id %>">上一页</a>
<% }else{ %>
上一页
<%}%>
<% if(intPage < intPageCount){ %>
<a href="produit.jsp?page=<%= intPage+1%>&p_bc_id=<%= p_bc_id %>&p_sc_id=<%= p_sc_id %>">下一页</a>
<% }else{ %>
下一页
<%}%>
</td>
</tr>
</table>
<table cellpadding=0 cellspacing=0 width="100%">
<tr>
<td align="left" class="style2">双击每行可查看员工详细资料</td>
<td align="right"><input name="chkall" type="checkbox" id="chkall" value="select" onClick="CheckAll(this.form)" style="border:0">
全选
<input type="submit" value="删 除" class="button" onClick="return confirm('此操作无法恢复!!!请慎重!!!\n\n确定要删除员工吗?')">
</td>
</tr>
</table></td>
</tr>
</table>
</form></td>
<td></td>
</tr>
<tr>
<td><img src="../images/system/r_4.gif" alt="" width="6" height="6" /></td>
<td></td>
<td><img src="../images/system/r_3.gif" alt="" width="6" height="6" /></td>
</tr>
</table>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -