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

📄 goodsinfo.jsp

📁 JSP软件工程案例精解 书中的webStore例子源码
💻 JSP
字号:
<%@ page contentType="text/html;charset=gb2312"%>
<%@include file="comm.jsp"%>
<%@page import="java.util.*"%>
<%@page import="java.io.*"%>
<%@page import="java.sql.*,java.lang.Double.*"%>
<html>
    
<body >
<div>
  <table>
     <tr>
	<td width="236" align=center valign=top><br>
		<p ><font color="#000080"><a href=SysuserInfo.jsp?action=mine>我的资料</a></font></p>
		<p>类别信息
		<br>&nbsp;<a href="TypeInfo.jsp?action=type_list">类别列表</a>
		<br>&nbsp;<a href="TypeInsert.htm">添加类别</a></p>
		<p>商品信息
		<br>&nbsp;<a href="GoodsInfo.jsp?action=view&type=1">可用商品</a>
		<br>&nbsp;<a href="GoodsInfo.jsp?action=view&type=2">过线商品</a>
		<br>&nbsp;<a href="GoodsInsert.htm">添加商品</a></p>
		<p>订单管理
		<br>&nbsp;<a href="GoodsTrans.jsp?action=view&type=2">已提交</a>
		<br>&nbsp;<a href="GoodsTrans.jsp?action=view&type=3">已发货</a></p>
	</td>	

<%
String SysuserID=(String)session.getValue("sysuser");
String SysuserType=(String)session.getValue("sysuserType");
String Type=request.getParameter("type");
int iType=Integer.parseInt(Type);
action=request.getParameter("action");

if(SysuserID==null||SysuserType.compareTo("商品管理员")!=0)
{
%>
	<jsp:forward page="SysuserLogin.htm"/>
<%
}

if(action.equals("goods_insert"))
{
	String GoodsName=request.getParameter("GoodsName");
	String GoodsTypeID=request.getParameter("GoodsTypeID");
	String Price=request.getParameter("Price");
	String NumNow=request.getParameter("NumNow");
	String NumHigh=request.getParameter("NumHigh");
	String NumLow=request.getParameter("NumLow");
	String GoodsDescr=request.getParameter("GoodsDescr");

	strSql="{call dbo.sp_InsertGoods(?,?,?,?,?,?,?,?)}";
	cstmt=conn.prepareCall(strSql);
	cstmt.setString(1,GoodsName);
	cstmt.setInt(2,Integer.parseInt(GoodsTypeID));
	cstmt.setDouble(3,Double.parseDouble(Price));
	cstmt.setInt(4,Integer.parseInt(NumNow));
	cstmt.setInt(5,Integer.parseInt(NumHigh));
	cstmt.setInt(6,Integer.parseInt(NumLow));
	cstmt.setString(7,GoodsDescr);
	cstmt.setString(8,SysuserID);

	cstmt.executeUpdate();
	
	String tmp=new String(GoodsName.getBytes("8859_1"),"gb2312");

	out.print("<p align=center>添加"+ tmp +"成功</p>");
}
	
if(action.equals("goods_del"))
{
	String GoodsID=request.getParameter("GoodsID");
	
	strSql="{call dbo.sp_DelGoods(?)}";
	cstmt=conn.prepareCall(strSql);
	cstmt.setString(1,GoodsID);
	cstmt.executeUpdate();

}

%>
	<td align=center valign=top>
	<p align=center>欢迎您:<%=SysuserID%>(<%=SysuserType%>)</p>
	<table>商品列表
	  <tr bgcolor=#E9E9D1>
		<td width=70>ID</td>
		<td width=159>商品名</td>
		<td width=129>商品类型</td>
		<td width=80>单价</td>
		<td width=80>当前数量</td>
		<td width=50></td>
	 </tr>
<%
	strSql="{call dbo.sp_GetAllGoods(?)}";
	cstmt=conn.prepareCall(strSql);
	cstmt.setInt(1,iType); //获取所有商品信息
	rs=cstmt.executeQuery();
	while(rs.next())
	{ %>
	  <tr bgcolor="#EAFfFff">
		<td><a href=GoodsDetail.jsp?action=goods_view&GoodsID=<%=rs.getString(1)%>>
		    <%=rs.getInt(1)%></td>
		<td><%=new String(rs.getString(2).getBytes("8859_1"),"gb2312")%></td>
		<td><%=new String(rs.getString(3).getBytes("8859_1"),"gb2312")%></td>
		<td><%=rs.getDouble(4)%></td>
		<td><%=rs.getInt(5)%></td>
		<td><a href=GoodsInfo.jsp?action=goods_del&GoodsID=<%=rs.getString(1)%>&type=1>删除</a></td>
	  </tr>
	<%}%>
	</table>
	</td> 
<%	

rs.close();
cstmt.close();
conn.close();	

%>

</tr>
</table>
</div>
</body>

</html>

⌨️ 快捷键说明

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