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

📄 addpart.jsp

📁 这是一个简单但是很实用的JSP应用实例
💻 JSP
字号:
<%@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*" errorPage="" %>
<%@ page import="java.lang.*,java.text.*,java.util.*,java.io.*" %>
<%@include file="/db/dbPool.inc"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="/lib/main.css" rel="stylesheet" type="text/css">
<title>添加工位零部件</title>
<style type="text/css">
<!--
body {
	margin-left: 3px;
	margin-top: 3px;
	margin-right: 3px;
	margin-bottom: 3px;
}
-->
</style>

</head>
<script src="/lib/jsFunc.js"></script>
<script src="/office/lib/strfunc.js"></script>
<script language="javascript">
var add=false;
</script>
<jsp:useBean id="pageList" scope="session" class="myLib.PageList" />
<jsp:useBean id="queryBean" scope="page" class="Query.Query"/>
<BODY onBlur="if(!add) window.focus()">
<%
	String[] bInfo=(request.getParameter("bInfo")).split(":");
    String wID=bInfo[1];
    String sID=bInfo[2];
	session.putValue("bInfo",bInfo);
	String query_pName=request.getParameter("query_pName");
	String whereStr="";
	
	if(query_pName!=null && !query_pName.equals(""))
		whereStr+=" and pName like '%"+query_pName+"%' ";
	pageList.Init(15,request);//分页初始化
	queryBean.initialize(conn1);
	String sql="select distinct pID,pName from wBOM where sID='"+sID+"' and wID!='"+wID+"' and pID!='' and pID not in (select pID from wBOM where sID='"+sID+"' and wID='"+wID+"')"+whereStr;
    sql=pageList.setOrderBy(sql,"pID","desc");
	ResultSet rs=queryBean.executeQuery(sql);
	int recordCount=0;
	if(rs.last())
		recordCount=rs.getRow();
	else
		recordCount=0;
	pageList.splitPage(recordCount);
%>
<form name="queryForm"  action="addPart.jsp" method="post">
<table width="70%" border="0" cellpadding="0" cellspacing="0"  align="center">
  <tr><td><strong>请选择您要添加的零部件种类:</strong></td></tr>
  <tr>
    <td align="left">
	  零部件名称:
      <input type="text" name="query_pName" class="border1Pixel" onMouseOver="add=true;">&nbsp;
	  <input type="submit" name="btnQuery" onMouseOut="this.style.color='000000'" onMouseOver="this.style.color='FF0000'" class="logonBtn" value="查询">
    </td>
  </tr>
</table>
<table width="70%" border="1" cellpadding="1" cellspacing="0"  align="center"  class="officeTab"   bordercolor="cccccc">
 	<tr height="26"  bgcolor="#efefef"  class="OfficeTitTd" >
        <td width="34" height="26"  align="center">
          <input name="selAll" <% if(recordCount==0)  out.print(" disabled "); %> type="checkbox" id="selAll" value="checkbox" onClick="chkAll(this,'gid');setDelBtn(gid);setCopyBtn(gid);">
        </td>
		<td width="35%" align="center"><strong><%=pageList.setSortTit("pID","零部件编码","按零部件编码排序","#000099")%></strong></td>
        <td align="center"><strong><%=pageList.setSortTit("pName","零部件名称","按零部件名称排序","#000099")%></strong></td>
	</tr>
      <%if(recordCount==0){ %>
  <tr bgcolor="#FFFFFF">
        <td height="25" colspan="7" align="center" class="tdBottom"><b><font color="#FF0000">没有零部件信息 </font></b></td>
  </tr>
	  <%
	  	}else{
        int c=0;
		if(!rs.absolute((pageList.m_curPage-1)*pageList.m_pageSize+1))
			c=pageList.m_pageSize;
		else
			c=0;		
		String pID="";
		String pName="";
		while( c<pageList.m_pageSize){
			pID=rs.getString("pID");
			pName=rs.getString("pName");
%>
      <tr id="RowItem<%=pID%>" class="SelRowItem" bgcolor="#FFFFFF" height="23" > 
        <td align="center" width="34" bgcolor="efefef">
          <input name="gid" type="checkbox" id="gid" value="<%=pID%>" onClick="setDelBtn(gid);setCopyBtn(gid);">
	    </td>
		<td align="center"><%=pID%></td>
		<td align="center"><%=pName%></td>
<%	
        c++;
		if(!rs.next())
			break;	
		}}
%>
</table>
<table align="center" width="70%" border="0" cellpadding="0" cellspacing="0">
  <tr><td onMouseOver="add=true;"><%out.print(pageList.showPage("",false));%></td></tr>
</table>
<table width="100%" border="0" cellpadding="5" cellspacing="0">
  <tr><td colspan="2" align="center">
    <input type="button" class="flatBtn" value="添 加" onClick="add=true;queryForm.action='handle_addPart.jsp';queryForm.submit();" style="width:50">
	<input type="button" class="flatBtn" value="关 闭" onClick="window.close()" style="width:50">
  </td></tr>
</table>
</form>
</BODY>
</HTML>
<%@ include file="/db/dbpoolEnd.inc" %>
<script src="/lib/jsFooter.js"></script>

⌨️ 快捷键说明

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