📄 model.jsp
字号:
<%@ page language="java" contentType="text/html;charset=GBK" import="imis.*,java.util.*,java.text.*,javax.naming.*,javax.rmi.PortableRemoteObject,java.sql.*" %> <% response.setHeader("Pragma","No-cache"); response.setHeader("Cache-Control","no-cache"); response.setDateHeader("Expires", 0); request.setCharacterEncoding("GBK"); session=request.getSession(); userStruct user=null; user=new userStruct(); user=(userStruct)session.getAttribute("user"); if(user==null){ response.sendRedirect("../../login.html"); }Vector emod = new Vector();Collection collect = new ArrayList();String url=new String();//url="jdbc:db2://127.0.0.1:6789/imis";//Class.forName("COM.ibm.db2.jdbc.net.DB2Driver");url="jdbc:sybase:Tds:172.16.0.1:4000/imis"; Class.forName("com.sybase.jdbc2.jdbc.SybDriver");Connection con=DriverManager.getConnection(url,"wmj","197555");Statement stmt=con.createStatement();ResultSet rs=null;String devtype = (String)session.getAttribute("devtype");String manu = (String)session.getAttribute("manu");String contract = (String)session.getAttribute("contract");if(devtype!=null)session.removeAttribute("devtype");if(manu!=null) session.removeAttribute("manu");if(contract!=null) session.removeAttribute("contract");String sql="";if(devtype!=null&&manu!=null){int type = (new Integer(devtype)).intValue();if(type!=-1&&!manu.equals("-1")){ sql="select device_id from equipmentdetails where type="+type+" and company='"+manu+"'";}if(type!=-1&&manu.equals("-1")){sql="select device_id from equipmentdetails where type="+type+"";}if(type==-1&&!manu.equals("-1")){sql="select device_id from equipmentdetails where company='"+manu+"'";}if(type==-1&&manu.equals("-1")){sql="select device_id from equipmentdetails";}}if(devtype==null&&manu!=null){if(!manu.equals("-1")){sql="select device_id from equipmentdetails where company='"+manu+"'";}if(manu.equals("-1")){sql="select device_id from equipmentdetails";}}if(devtype!=null&&manu==null){int type = (new Integer(devtype)).intValue();if(type!=-1){sql="select device_id from equipmentdetails where type="+type+"";}if(type==-1){sql="select device_id from equipmentdetails";}}if(devtype==null&&manu==null){sql="select device_id from equipmentdetails";}Collection c = new ArrayList();rs=stmt.executeQuery(sql);while(rs.next()){String mm=rs.getString("device_id");c.add(mm);}rs.close();stmt.close();con.close();Context ctx1=new InitialContext();Object ref1=ctx1.lookup("EquipmentControllerEJB");EquipmentControllerEJBHome eqHome=(EquipmentControllerEJBHome) PortableRemoteObject.narrow(ref1,EquipmentControllerEJBHome.class);EquipmentControllerEJB eqController = eqHome.create();EquipmentDetailsStruct eqd = new EquipmentDetailsStruct();EquipmentJBean eqj = new EquipmentJBean();Collection ec = new ArrayList();Context conctx = new InitialContext(); //look up jndi name Object conref = conctx.lookup("ContractController"); //cast to Home interface ContractControllerHome contractControllerHome = (ContractControllerHome) PortableRemoteObject.narrow(conref, ContractControllerHome.class); ContractController contractController = contractControllerHome.create(); Collection cc = new ArrayList(); ContractJBean cjb = new ContractJBean();if(contract!=null){if(!contract.equals("-1")){String contractid="";cc = contractController.getAll();Iterator ci = cc.iterator();while(ci.hasNext()){cjb = (ContractJBean)ci.next();if(cjb.contractname.equals(contract)){contractid = cjb.getContractId();break;}}Iterator i = c.iterator();while(i.hasNext()){String devid = (String)i.next();eqj = eqController.getEquipmentByDeviceid(devid);if(eqj.getContractid().equals(contractid)) { ec.add(eqj.getDeviceid()); }}}else{ec.addAll(c);}}else{ec.addAll(c);}Iterator eqdi = ec.iterator();while(eqdi.hasNext()) {String eid = (String)eqdi.next();eqd = eqController.getEqdetailsByDeviceid(eid);emod.addElement(eqd.getModel());}for(int l=0;l<emod.size()-1;l++) for(int k=l+1;k<emod.size();k++) { if(emod.elementAt(l).equals(emod.elementAt(k))) { emod.remove(k); k--; } }for(int l=0;l<emod.size();l++){collect.add(emod.elementAt(l));}%><HTML><HEAD><TITLE>MSA-office</TITLE><META content="MSHTML 5.50.4134.600" name=GENERATOR><link rel="stylesheet" href="../../css/msa.css" type="text/css"><script language="JavaScript" src="../../public/util/select.js"></script><script language="javascript" src="../../public/js/table.js"></script><meta http-equiv="Content-Type" content="text/html; charset=gb2312"><BODY class="bg" topMargin="0" leftmargin="0" rightmargin="0" marginwidth="0" marginheight="0"><div align=right> <TABLE width=104% height="100%" border=0 align="right" cellPadding=0 cellSpacing=0 class=outter> <TBODY> <TR> <TD><IMG height=4 src="../../MacOS/lefttop.gif" width=6></TD> <TD height="3" colSpan=3 background=../../MacOS/top.gif><IMG height=4 src="../../MacOS/top.gif" width=1></TD> <TD><IMG src="../../MacOS/righttop.gif" width="7" height=4></TD> </TR> <TR> <TD vAlign=top background=../../MacOS/lwing.gif rowSpan=3><IMG height=18 src="../../MacOS/left.gif" width=6></TD> <TD vAlign=top background=../../MacOS/titlebg.gif width="16"> <DIV><img src="../../MacOS/logo.gif" width="16" height="16" border="0"></DIV></TD> <TD width="100%" height="18" align=center vAlign=top noWrap background=../../MacOS/titlebg.gif><SPAN style="BACKGROUND-COLOR: #cecece"><FONT class=strong> MSA-OFFICE </font></SPAN></TD> <TD><IMG height=18 src="../../MacOS/right_b2.gif" width=18 border="0"></TD> <TD vAlign=top background=../../MacOS/rwing.gif rowSpan=3><IMG height=18 src="../../MacOS/right.gif" width=7></TD> </TR> <TR> <TD height="2" colSpan=3 background=../../MacOS/hr.gif><IMG height=2 src="../../MacOS/hr.gif" width=1></TD> </TR> <TR> <TD colSpan=3 align="center" valign="top"> <table width="90%" border="1" cellspacing="1" bordercolor="#666666"> <tr bgcolor="#FAFAFA"> <td valign="top"> <table width="100%" border="0" cellspacing="0" cellpadding="2"> <form> <tr bgcolor="#fafafa"> <td width="27%"> <font class="strong" > 名称:</font> </td> <td width="30%"> <input name="typeName" type="text" class="file" value="" size="20" maxlength="40"> </td> <td> <input type="button" name="submit" value="查询" class="file" onclick="SearchValueFromTable(window.oMain,1,window.document.forms[0].typeName.value)"> <input type="reset" name="reset" value="重添" class="file"> </td> </tr> </form> </table> <table id="oMain" class=title width="100%" border="0" cellspacing="0" cellpadding="2" onmouseover="bgChange()" onmouseout="bgBack()" onClick="javascript:rtnValues(2)"> <tr> <td colspan="2" height="17" bgcolor="#666666"><font class="strongw">请选择设备型号</font></td> </tr> <% Iterator i=collect.iterator(); int count=0; while(i.hasNext()){ count++; String eqmodel=(String)i.next(); if(count%2==0){ %> <tr align=middle bgcolor="#e0e0e0"> <% }else { %> <tr align=middle bgcolor="#fafafa"> <% } %> <td width="30%" style="display:none"></td> <td width="70%" height="20"><%=eqmodel%></td> </tr> <%}%> </table></td> </tr> </table> </TD> </TR> <TR> <TD vAlign=top background=../../MacOS/lwing.gif> </TD> <TD colSpan=3 align="center" valign="bottom"><table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td background="../../MacOS/hr.gif"><img src="../../MacOS/hr.gif" width="1" height="2"></td> </tr> <tr> <td> <div align="right"><a href="../../help.htm" style="cursor:help" title="使用帮助" target="blank"><img src="../../MacOS/help.gif" width="16" height="16" border="0"> HELP</a></div></td> </tr> </table></TD> <TD vAlign=top background=../../MacOS/rwing.gif> </TD> </TR> <TR> <TD height="7"><IMG height=7 src="../../MacOS/leftbottom.gif" width=6></TD> <TD background=../../MacOS/bottom.gif colSpan=3><IMG height=7 src="MacOS/bottom.gif" width=1></TD> <TD><IMG height=7 src="../../MacOS/rightbottom.gif"width=7></TD> </TR> </TBODY> </TABLE></div></BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -