ITPub博客

首页 > 应用开发 > Java > JSP(6) - 进货模块

JSP(6) - 进货模块

原创 Java 作者:zhyuh 时间:2005-06-14 16:00:15 0 删除 编辑

处理商品进货信息,并允许根据商品编号核实该商品详细信息及存货信息。

要点:
1) 点击button触发javascript 事件

function checkID() {
document.frmComm.action = './jsp/purch_in_bef.jsp';
document.frmComm.submit();
}
......


2) 在同一页面中,将页面输入结果传入数据库,并显示数据库返回的处理结果
商品名称: 

以及源代码中以上部分


3)处理select 类型的对象
进货类型:

[@more@]

'purch_in_bef.jsp:

<%@ page contentType="text/html; charset=GBK" %>
<%@ page language="java" import="java.util.*" %>
<%@ page import="java.sql.*" %>
<%@ page import="java.text.SimpleDateFormat" %>
<%@ page import="java.text.DateFormat" %>
<%
response.setHeader("Cache-Control","no-store"); //HTTP 1.1
response.setHeader("Pragma","no-cache"); //HTTP 1.0
response.setDateHeader("Expires", 0); //prevents caching at the proxy server

String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
java.util.Date d=new java.util.Date();
DateFormat dFormat=new SimpleDateFormat("yyyy-MM-dd",Locale.CHINESE);

String sExchId = request.getParameter("exch_id");
String sExchName = "";
String sExchUnit = "";
String sExchQutt = "";

String sCommQutt = request.getParameter("exch_qutt");
String sExchType = request.getParameter("exch_type");

boolean rsnull=true;

if(sExchId != null && !sExchId.equals("")){

Class.forName("oracle.jdbc.driver.OracleDriver").newInstance();
String url="jdbc:oracle:thin:@TCSCH074.tcsgdccn.com:1521:orcl";
//orcl为你的数据库的SID
String user="store";
String password="store";
Connection conn= DriverManager.getConnection(url,user,password);
String sQuery = null;
Statement stmt = null;
ResultSet rs = null;

try{

sQuery = "select comm_name, comm_unit, comm_qutt from commodity ";
sQuery = sQuery + " where comm_id='"+sExchId+"'";

stmt = conn.createStatement();
rs = stmt.executeQuery(sQuery);

while(rs.next())
{
rsnull=false;
sExchName = rs.getString("comm_name");
sExchUnit = rs.getString("comm_unit");
sExchQutt = rs.getString("comm_qutt

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/207/viewspace-800176/,如需转载,请注明出处,否则将追究法律责任。

下一篇: JSP(7) - 销售模块
请登录后发表评论 登录
全部评论
  • 博文量
    233
  • 访问量
    2009606