我输上字符串spdm或者000能传回去,请问怎么把数据库里面调出来的值传回父页面
父页面?
<%@ page language="java" contentType="text/html; charset=utf-8"
pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
<script>
function aa(){
window.open("son.jsp","ceshi7");
}
</script>
</head>
<body>
<div>
<table>
<tr>
<td>供货方:<input type="text" name="ghf" /></td>
<td>入库类别:
<select name="rklb">
<option value="1" selected>采购入库</option>
<option value="2">盘点入库</option>
<option value="3">期初入库</option>
<option value="4">调拨入库</option>
<option value="5">退货入库</option>
</select>
</td>
</tr>
<tr>
<td>应付款:<input type="text" name="yfk" readonly /></td>
<td>附加费:<input type="text" name="fjf" /></td>
<td>实付款:<input type="text" name="sfk"></td>
</tr>
<tr>
<td>付款日期:<input type="text" name="fkrq" readonly /></td>
<td>出库单号:<input type="text" name="ckdh" readonly /></td>
</tr>
<tr>
<td>备注:<input type="text" name="bz" /></td>
<td>操作员:<input type="text" name="czy" /></td>
</tr>
<tr>
<td>商品名称:<input type="text" name="spmc" /></td>
</tr>
<tr>
<td><input type="button" name="button1" value="添加商品" onclick="aa()" /></td>
</tr>
</table>
</div>
<div>
<table id="table1">
</table>
</div>
</body>
</html>
子页面
<%@ page contentType="text/html;charset=utf-8" language="java"%>
<% request.setCharacterEncoding("utf-8"); %>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
<%@ page import="java.sql.*,java.io.*"%>
<script>
function bb(){
var v=document.f.username.value;
//var spdm = document.getElementByName("username").value;
//var spgg = document.getElementByName("spgg");
target = opener.window.table1;
var newRow = target.insertRow(0);//创建一行
//target.insertCell(0);
//target.rows[0].cells[0].appendChild(document.createTextNode("Cell 1.1"));
//target.rows[0].insertCell(1);
//target.rows[0].cells[1].appendChild(document.createTextNode("Cell 2.1"));
newCell = newRow.insertCell(-1);//创建一列
newCell1 = newRow.insertCell(0);
newCell.innerText="spdm";
newCell1.innerText="000";
}
</script>
<table>
<%String name = request.getParameter("spmc"); %>
<form method="post" action="son.jsp">
<tr>
<td>请输入商品名称:<input type="text" name="spmc" /></td>
<td><input type="submit" name="tj" value="查询" ></td>
</tr>
</form>
</table>
<table>
<thead>
<tr>
<th width="70px">所属机构</th>
<th width="70px">商品代码</th>
<th width="70px">商品名称</th>
<th width="70px">条形码</th>
<th width="70px">商品规格</th>
<th width="70px">商品单位</th>
<th width="70px">包装数量</th>
<th width="70px">包装单位</th>
<th width="70px">厂家标识</th>
<th width="70px">商品类别</th>
<th width="70px">进货价</th>
<th width="70px">出货价</th>
<th width="70px">启用日期</th>
<th width="70px">停用日期</th>
<th width="70px">库存下限</th>
<th width="70px">输入码</th>
<th width="70px">注释</th>
<th width="70px">操作员</th>
</tr>
</thead>
<%
int pageSize=10;
int pageCount;
int showPage;
//String name = request.getParameter("spmc");
Connection con;
Statement sql;
ResultSet rs;
Class.forName("oracle.jdbc.driver.OracleDriver");
String dbUrl = "jdbc:oracle:thin:@11.11.11.1:1521:sale";//这里要写上IP地址和oracle的那个数据库的服务名
String dbUser = "tanton";
String dbPwd = "******";
con = DriverManager.getConnection(dbUrl,dbUser,dbPwd);
sql=con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_READ_ONLY);
%>
<%
try{
//返回可滚动的结果集
rs=sql.executeQuery("select * from PRODUCT_DICT where PRODUCT_NAME='"+name+"'");
//将游标移到最后一行
rs.last();
//获取最后一行的行号
int recordCount=rs.getRow();
//计算分页后的总数
pageCount=(recordCount%pageSize==0)?(recordCount/pageSize):(recordCount/pageSize+1);
//获取用户想要显示的页数:
String integer=request.getParameter("showPage");
if(integer==null){
integer="1";
}
try{showPage=Integer.parseInt(integer);
}catch(NumberFormatException e){
showPage=1;
}
if(showPage<=1){
showPage=1;
}
if(showPage>=pageCount){
showPage=pageCount;
}
//如果要显示第showPage页,那么游标应该移动到的position的值是:
int position=(showPage-1)*pageSize+1;
//设置游标的位置
rs.absolute(position);
//用for循环显示本页中应显示的的记录
for(int i=1;i<=pageSize;i++){
%>
</table><table>
<form name="form" method="post" action="" >
<tbody>
<tr><td>
<tr>
<td width="70px"><%=rs.getString("AGENCY_CODE")%></td>
<td width="70px"><%=rs.getString("PRODUCT_CODE")%></td>
<td width="70px"><%=rs.getString("PRODUCT_NAME")%></td>
<td width="70px"><%=rs.getString("BAR_CODE")%></td>
<td width="70px"><%=rs.getString("PRODUCT_SPEC")%></td>
<td width="70px"><%=rs.getString("UNITS")%></td>
<td width="70px"><%=rs.getString("AMOUNT_PER_PACKAGE")%></td>
<td width="70px"><%=rs.getString("PACKAGE_UNITS")%></td>
<td width="70px"><%=rs.getString("FIRM_ID")%></td>
<td width="70px"><%=rs.getString("PRODUCT_TYPE")%></td>
<td width="70px"><%=rs.getString("TRADE_PRICE")%></td>
<td width="70px"><%=rs.getString("RETAIL_PRICE")%></td>
<td width="70px"><%=rs.getString("START_DATE")%></td>
<td width="70px"><%=rs.getString("LOWER_STOCK")%></td>
<td width="70px"><%=rs.getString("INPUT_CODE")%></td>
<td width="70px"><%=rs.getString("MEMOS")%></td>
<td width="70px"><%=rs.getString("OPERATOR_ID")%></td>
<td width="70px"><input type="button" value="添加" onclick="bb()"></td>
</tr>
</tbody>
</table>
<form name="f" action="b.jsp">
<table>
<tr>
<td>
<input type="hidden" name="username" value="555">
</td>
</tr>
<tr>
<td>
<input type="button" name="validator" onclick="bb()" value="添加">
</td>
</tr>
</table>
</from>
<%
rs.next();
}
con.close();
rs.close();
sql.close();
}catch(Exception e){
e.printStackTrace();
}%>