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

📄 order_99_1.jsp

📁 该系统是一个B/S结构的公司定饭系统,整套软件由JSP编制,希望大家能够多提宝贵意见,但请不要将它应用于商业环境,如实在要使用的话,请与作者联系!(使用此系统无比要有ORACLE8i以上版本数据库!)
💻 JSP
字号:
<%@ page contentType="text/html; charset=GB2312" %>
<%@ page import="com.hzs.order.*" %>
<jsp:useBean id="DB" scope="page" class="com.hzs.order.DBHandle" />
<%
if (session.getAttribute("grade")==null ||  session.getAttribute("user_nm")==null)
{
%>
      <jsp:forward page="con_error.jsp">
      <jsp:param name="error_nm" value="非 法 操 作" />
      <jsp:param name="error_all" value="非法操作,请重新登陆!" />
     </jsp:forward>
<%
}
Vector Result=new Vector();
Vector Result_cp=new Vector();
String flg;
if (request.getParameter("sel_cp")!=null)
{
  flg=DBHandle.toChinese(request.getParameter("sel_cp"));
 }
 else
 {
  flg="";
}
              try{
               DB.connect();
               Result_cp=DB.select("SELECT cp_id,cp_nm FROM all_cp order by cp_id");
              if (flg.equals(""))
               {
                flg=Result_cp.elementAt(0).toString();
                }
              DB.close();
              }
            catch(DBException  e)
            {
            %>
      <jsp:forward page="con_error.jsp">
      <jsp:param name="error_nm" value="数 据 库 错 误" />
      <jsp:param name="error_all" value="<%=e.getMessage()%>"/>
      </jsp:forward>
          <%
          }
          finally{
              DB.close();
              }
          if (Result_cp.size()==0)
          {
          %>
          <jsp:forward page="con_error.jsp">
        <jsp:param name="error_nm" value="数 据 库 错 误" />
        <jsp:param name="error_all" value="数据库中尚没有预定公司数据,请先添加!"/>
        </jsp:forward>
          <%
          }
%>
<html>
<head>
<title>菜单检索页</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link rel="stylesheet" href="css/global.css" type="text/css">
<style type="text/css">
<!--
td {  text-align: center; border: 1px solid}
-->
</style>
<script language="javascript">
function do_chose(id)
{
  opener.document.fo_main.tx_food.value=eval("document.fo_main.hid_foodnm"+id+".value");
  opener.document.fo_main.tx_price.value=eval("document.fo_main.hid_foodprice"+id+".value");
  opener.document.fo_main.tx_mount.value=eval("1");
  opener.document.fo_main.hid_tel.value=eval("document.fo_main.hid_foodtel"+id+".value");
  opener.count_price();
}
function do_submit()
{
document.fo_main.submit();
}
</script>
</head>

<body bgcolor="#FFFFFF" text="#000000" background="images/menu.gif">
<%
  try{
  DB.connect();
  Result=DB.select("SELECT * FROM all_food where food_tel='"+flg+"' order by food_id");
  DB.close();
  }
  catch(DBException  e)
{
%>
      <jsp:forward page="con_error.jsp">
      <jsp:param name="error_nm" value="数 据 库 错 误" />
      <jsp:param name="error_all" value="<%=e.getMessage()%>"/>
      </jsp:forward>
<%
}finally{
		DB.close();
	}

  out.print("<h2>---今 日 菜 单 一 览---<br></h2>");
  if (Result.size()==0)
  {
 %>
	<jsp:forward page="con_error.jsp">
      <jsp:param name="error_nm" value="数 据 库 错 误" />
      <jsp:param name="error_all" value="目前数据库中尚没有菜单信息!"/>
      </jsp:forward>
<%
  }
  else
  {
%>
<form name="fo_main" action="order_99_1.jsp" method="post">
  <table align="center">
    <tr>
      <th>
        选择定饭公司:
      </th>
      <td>
        <div align="left">
          <select name="sel_cp" onchange="do_submit();">
          <%
          int j;
           String tempstr="";
          for (j=0;j<Result_cp.size();j++)
          {
          tempstr=Result_cp.elementAt(j).toString();
          %>
          <option value="<%=Result_cp.elementAt(j++).toString()%>"
          <%
          if (flg.equals(""))
          {
            if (j==0)
            {
                out.print("selected");
            }
          }
          else{
            if (tempstr.equals(flg))
              {
                out.print("selected");
              }
            }
          %>
          >
          <%=Result_cp.elementAt(j).toString()%></option>
          <%
          }
            %>
          </select>
        </div>
      </td>
    </tr>
  </table>
  <br>
  <div align="left"></div>
  <center>
    <table width="90%">
    <tr>
    <th>菜 名:</th>
    <th>单 价:</th>
    <th>定饭电话:</th>
    <th>&nbsp;</th>
  </tr>
<%
int i=0;
String id;
for (i=0;i<Result.size();i++)
{
  id=Result.elementAt(i++).toString();
  out.print("<tr><td><input type=\"hidden\" name=\"hid_foodnm"+id+"\" value=\""+Result.elementAt(i).toString()+"\">"+Result.elementAt(i++).toString()+"</td><td><input type=\"hidden\" name=\"hid_foodprice"+id+"\" value=\""+Result.elementAt(i).toString()+"\">"+Result.elementAt(i++).toString()+"</td><td><input type=\"hidden\" name=\"hid_foodtel"+id+"\" value=\""+Result.elementAt(i).toString()+"\">"+Result.elementAt(i).toString()+"</td><td><input type=\"button\" value=\"选 择\" onclick=\"do_chose('"+id+"');\"></td></tr>");
}
%>
  </table>
<%
  }
%>
<BR><BR>
<input type="button" value="关 闭" onclick="self.close();">
</center>
</form>
</body>
</html>

⌨️ 快捷键说明

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