首页上一页 1 下一页尾页 7 条记录 1/1页
关于一张页面使用两个
发表在JavaWeb图书答疑
2009-05-31
是否精华
是
否
版块置顶:
是
否
<%@ page contentType="text/html;charset=gb2312" language="java"%>
<%@ page import="java.sql.*,java.io.*"%>
<jsp:useBean id="rst" scope="page" class="com.shop.tool.DBResult" />
<jsp:useBean id="calendar" scope="page" class="com.shop.tool.ShowTime" />
<html>
<title>格子商品添加</title>
<meta http-equiv="Content-Type" content="text/html;charset=gb2312">
<link href="../CSS/style.css" rel="stylesheet" type="text/css">
<body>
<%
request.setCharacterEncoding("gb2312");
String strSql = "select * from lattice";
String maxCount = "select max(g_mark) from goods";
ResultSet rs = rst.getResult(strSql);
String jc = "";
String l_end = "";
String l_money = "";
String l_width = "";
String l_owner = "";
String l_height = "";
String l_length = "";
String spid = "";
String l_id = "";
String dw = "";
String theMax = "";
String rkl_id = (String) request.getParameter("rkl_id");
String rkStr = "select * from lattice where l_id='" + rkl_id + "'";
ResultSet rs1 = rst.getResult(rkStr);
if (rs1.next()) {
l_end = rs1.getString("l_end");
l_money = rs1.getString("l_money");
l_width = rs1.getString("l_width");
l_height = rs1.getString("l_height");
l_owner = rs1.getString("l_owner");
l_length = rs1.getString("l_length");
l_id = rs1.getString("l_id");
}
ResultSet rs2 = rst.getResult(maxCount);
if (rs2.next()) {
theMax = rs2.getString(1);
}
//将最大的字段加1
String rkbh = "SP" + calendar.getDateString()
+ (Integer.parseInt(theMax.substring(10)) + 1);
%>
<table width="584" border="0" cellspacing="0" cellpadding="0"
align="center">
<tr>
<td height="27" colspan="6" bgcolor="#EEEEEE"
class="tableBorder_gray" valign="bottom">
<span class="word_deepgrey"> 当前位置:商品管理> </span>添加格子物品 >>>
</td>
</tr>
<tr>
<td valign="top" height="83">
<br>
<table width="98%" height="112" border="0" align="center"
cellpadding="1" cellspacing="1" bgcolor="#F2F2F2">
<tr>
<td width="274">
<th scope="row">
<form name="form1" method="post" action="test.jsp">
<tr>
<td height="27">
<select name="rkl_id" onChange="spchange()">
<option selected="selected">
请选择相应的格子编号
</option>
<%
while (rs.next()) {
%>
<option value=<%=rs.getString("l_id")%>>
GZ<%=rs.getString("l_id")%>
</option>
<%
}
%>
</select>
</td>
<td width="276">
注:带*号为必填项
</td>
</tr>
<tr>
<td height="27">
商品编号:
<font color="#585858"><%=rkbh%></font>
</td>
<td height="27">
格主名:
<font color="#585858"><%=l_owner%></font>
</td>
</tr>
<tr>
<td height="27">
格子名称:
<font color="#585858">GZ<%=l_id%></font>
</td>
<td>
长宽高:
<font color="#585858"><%=l_length%>cm*<%=l_width%>cm*<%=l_height%>cm</font>
</td>
</tr>
<tr>
<td height="27">
到期时间:
<font color="#585858"><%=l_end%></font>
</td>
<td>
月租费:
<font color="#585858"><%=l_money%>(元)</font>
</td>
</tr>
</td>
</tr>
</form>
</th>
<tr>
<td>
<form name="form2" method="post" action="MyJsp.jsp">
<%
session.setAttribute("jc", jc);
session.setAttribute("l_id", l_id);
session.setAttribute("l_end", l_end);
session.setAttribute("l_money", l_money);
session.setAttribute("rkbh", rkbh);
session.setAttribute("l_length", l_length);
session.setAttribute("l_width", l_width);
session.setAttribute("l_owner", l_owner);
session.setAttribute("l_height", l_height);
session.setAttribute("spid", spid);
%>
<tr>
<td height="27">
物品名称:
<input type="text" name="g_name">
</td>
<td>
所属类别:
<select name="g_sort">
<option value="生活用品" selected>
生活用品
</option>
<option value="食品">
食品
</option>
<option value="学习用品">
学习用品
</option>
<option value="饰品">
饰品
</option>
<option value="数码产品">
数码产品
</option>
</select>
</td>
</tr>
<tr>
<td height="27">
数 量:
<input type="text" name="g_num">
(个)*
</td>
<td>
物品评估:
<select name="g_info">
<option value="极力推荐" selected>
极力推荐
</option>
<option value="促销产品">
促销产品
</option>
<option value="马马虎虎">
马马虎虎
</option>
<option value="购物有奖">
购物有奖
</option>
<option value="货真价实">
货真价实
</option>
</select>
</td>
</tr>
<tr>
<td height="27">
单 价:
<input type="text" name="g_price">
(元)*
</td>
<td>
总共金额:
<input type="text" style="width: 80px" readonly>
</td>
</tr>
<tr>
<td height="27">
操作人员:
<input type="text" readonly value="admin">
</td>
<input type="hidden" name="hl_id" value=<%=l_id%>>
</form>
<tr>
<td height="40" colspan="2" align="center">
<input name="mySubmit" type="button" value="保存信息"
onclick="check()" class="btn_grey">
<input name="myeset" type="reset" class="btn_grey" value="清除重置"
onClick="myreset()">
</td>
</tr>
</form>
</table>
</td>
</tr>
</table>
</body>
</html>
<script language='JavaScript'>
function spchange()
{
form1.submit();
}
function myreset()
{
form2.reset();
}
</script>
<%@ page import="java.sql.*,java.io.*"%>
<jsp:useBean id="rst" scope="page" class="com.shop.tool.DBResult" />
<jsp:useBean id="calendar" scope="page" class="com.shop.tool.ShowTime" />
<html>
<title>格子商品添加</title>
<meta http-equiv="Content-Type" content="text/html;charset=gb2312">
<link href="../CSS/style.css" rel="stylesheet" type="text/css">
<body>
<%
request.setCharacterEncoding("gb2312");
String strSql = "select * from lattice";
String maxCount = "select max(g_mark) from goods";
ResultSet rs = rst.getResult(strSql);
String jc = "";
String l_end = "";
String l_money = "";
String l_width = "";
String l_owner = "";
String l_height = "";
String l_length = "";
String spid = "";
String l_id = "";
String dw = "";
String theMax = "";
String rkl_id = (String) request.getParameter("rkl_id");
String rkStr = "select * from lattice where l_id='" + rkl_id + "'";
ResultSet rs1 = rst.getResult(rkStr);
if (rs1.next()) {
l_end = rs1.getString("l_end");
l_money = rs1.getString("l_money");
l_width = rs1.getString("l_width");
l_height = rs1.getString("l_height");
l_owner = rs1.getString("l_owner");
l_length = rs1.getString("l_length");
l_id = rs1.getString("l_id");
}
ResultSet rs2 = rst.getResult(maxCount);
if (rs2.next()) {
theMax = rs2.getString(1);
}
//将最大的字段加1
String rkbh = "SP" + calendar.getDateString()
+ (Integer.parseInt(theMax.substring(10)) + 1);
%>
<table width="584" border="0" cellspacing="0" cellpadding="0"
align="center">
<tr>
<td height="27" colspan="6" bgcolor="#EEEEEE"
class="tableBorder_gray" valign="bottom">
<span class="word_deepgrey"> 当前位置:商品管理> </span>添加格子物品 >>>
</td>
</tr>
<tr>
<td valign="top" height="83">
<br>
<table width="98%" height="112" border="0" align="center"
cellpadding="1" cellspacing="1" bgcolor="#F2F2F2">
<tr>
<td width="274">
<th scope="row">
<form name="form1" method="post" action="test.jsp">
<tr>
<td height="27">
<select name="rkl_id" onChange="spchange()">
<option selected="selected">
请选择相应的格子编号
</option>
<%
while (rs.next()) {
%>
<option value=<%=rs.getString("l_id")%>>
GZ<%=rs.getString("l_id")%>
</option>
<%
}
%>
</select>
</td>
<td width="276">
注:带*号为必填项
</td>
</tr>
<tr>
<td height="27">
商品编号:
<font color="#585858"><%=rkbh%></font>
</td>
<td height="27">
格主名:
<font color="#585858"><%=l_owner%></font>
</td>
</tr>
<tr>
<td height="27">
格子名称:
<font color="#585858">GZ<%=l_id%></font>
</td>
<td>
长宽高:
<font color="#585858"><%=l_length%>cm*<%=l_width%>cm*<%=l_height%>cm</font>
</td>
</tr>
<tr>
<td height="27">
到期时间:
<font color="#585858"><%=l_end%></font>
</td>
<td>
月租费:
<font color="#585858"><%=l_money%>(元)</font>
</td>
</tr>
</td>
</tr>
</form>
</th>
<tr>
<td>
<form name="form2" method="post" action="MyJsp.jsp">
<%
session.setAttribute("jc", jc);
session.setAttribute("l_id", l_id);
session.setAttribute("l_end", l_end);
session.setAttribute("l_money", l_money);
session.setAttribute("rkbh", rkbh);
session.setAttribute("l_length", l_length);
session.setAttribute("l_width", l_width);
session.setAttribute("l_owner", l_owner);
session.setAttribute("l_height", l_height);
session.setAttribute("spid", spid);
%>
<tr>
<td height="27">
物品名称:
<input type="text" name="g_name">
</td>
<td>
所属类别:
<select name="g_sort">
<option value="生活用品" selected>
生活用品
</option>
<option value="食品">
食品
</option>
<option value="学习用品">
学习用品
</option>
<option value="饰品">
饰品
</option>
<option value="数码产品">
数码产品
</option>
</select>
</td>
</tr>
<tr>
<td height="27">
数 量:
<input type="text" name="g_num">
(个)*
</td>
<td>
物品评估:
<select name="g_info">
<option value="极力推荐" selected>
极力推荐
</option>
<option value="促销产品">
促销产品
</option>
<option value="马马虎虎">
马马虎虎
</option>
<option value="购物有奖">
购物有奖
</option>
<option value="货真价实">
货真价实
</option>
</select>
</td>
</tr>
<tr>
<td height="27">
单 价:
<input type="text" name="g_price">
(元)*
</td>
<td>
总共金额:
<input type="text" style="width: 80px" readonly>
</td>
</tr>
<tr>
<td height="27">
操作人员:
<input type="text" readonly value="admin">
</td>
<input type="hidden" name="hl_id" value=<%=l_id%>>
</form>
<tr>
<td height="40" colspan="2" align="center">
<input name="mySubmit" type="button" value="保存信息"
onclick="check()" class="btn_grey">
<input name="myeset" type="reset" class="btn_grey" value="清除重置"
onClick="myreset()">
</td>
</tr>
</form>
</table>
</td>
</tr>
</table>
</body>
</html>
<script language='JavaScript'>
function spchange()
{
form1.submit();
}
function myreset()
{
form2.reset();
}
</script>