急迫!!救命!!!关于JSP页面之间传值问题,解决问题马上结帖 用js子窗口的参数传到父窗口中window.opener.forms[0].txtA.value="return value"; 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 A 页面<% String tvalue = "";if(request.getParameter("tvalue")!=null){ tvalue = request.getParameter("tvalue");}%><form action="b.jsp" method="post"> <input type="text" name="atext" value="<%=tvalue%>" /> <input type="submit" value="提交" /></form>b 页面<% String tvalue = "";if(request.getParameter("atext")!=null){ tvalue = request.getParameter("atext");}%><a href = a.jsp?tvalue =<%=tvalue%>>返回A页面</a>手里没有现成的例子,大概给你写了这些,应该就是这样的。 request.setAttribute(String,Object) request.getAttribute(String)或者session也可以,用完就remove。 同意 Ennis_wan(给上帝一双翅膀 这个我过去问过,已经解决了。这是源码。a.htm<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head><meta http-equiv="Content-Type" content="text/html; charset=gb2312"><title>无标题文档</title><script language="JavaScript" type="text/JavaScript"><!--function MM_openBrWindow(theURL,winName,features) { //v2.0 window.open(theURL,winName,features);}//--></script></head><body><form name="form1" method="post" action=""> <table width="400" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td width="94"> </td> <td width="306"> </td> </tr> <tr> <td> </td> <td><input name="text" type="text" id="text"></td> </tr> <tr> <td> </td> <td> </td> </tr> <tr> <td> </td> <td> </td> </tr> <tr> <td> </td> <td><input name="Submit" type="button" onClick="MM_openBrWindow('/b.htm','','scrollbars=yes,width=300,height=400')" value="打开新窗口"></td> </tr> </table></form></body></html>b.htm<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head><meta http-equiv="Content-Type" content="text/html; charset=gb2312"><title>无标题文档</title></head><script> function returnText() { window.opener.form1.text.value=form1.text.value; window.close(); }</script><body><table width="100%" height="300" border="0" cellpadding="0" cellspacing="0"> <tr> <td align="center"><form name="form1" method="post" action=""> <input name="text" type="text" id="text" value="请输入你的内容"> <br/> <input type="button" name="Submit" value="关 闭" onClick="returnText()"> </form> </td> </tr></table></body></html>这是网址http://community.csdn.net/Expert/topic/3170/3170466.xml?temp=.2616541 Ennis_wan(给上帝一双翅膀) 的可以最好用try,catch........ A 页面<% String tvalue = "";try{ tvalue=request.getParameter("tvalue"); } catch(Exception e) {tvalue = "";}%><form action="b.jsp" method="post"> <input type="text" name="atext" value="<%=tvalue%>" /> <input type="submit" value="提交" /></form>b 页面<% String tvalue = "";try{ tvalue=request.getParameter("atext"); } catch(Exception e1) {tvalue = "";}}%><a href = A.jsp?tvalue =<%=tvalue%>>返回A页面</a> 感觉用session是个不错的解决方案。有时我更喜欢用QueryString。 同意 Ennis_wan(给上帝一双翅膀) 给的方法 xwork-validator-1.0.2.dtd 校验时出错 现在我们应该用什么服务器? 求高人指导 checkbox 取值问题 大家来说一说奇不奇怪?????? html:multibox这个标签如何控制其是否选中? h:dataTable 加一空行 生成缩略图代码,在widnows2k下正常,在linux出现异常,请教原因 女士优先! jsp中如何将checkbox选中项删除? 求救!为什么我的servlet提交给自己会出错! 我如何生成一个javaBean的实例??? 明天去面试JSP程序员,大家进来给点意见或者祝福一下,谢谢,高分送。
<% String tvalue = "";
if(request.getParameter("tvalue")!=null){
tvalue = request.getParameter("tvalue");
}
%>
<form action="b.jsp" method="post">
<input type="text" name="atext" value="<%=tvalue%>" />
<input type="submit" value="提交" />
</form>b 页面
<% String tvalue = "";
if(request.getParameter("atext")!=null){
tvalue = request.getParameter("atext");
}
%>
<a href = a.jsp?tvalue =<%=tvalue%>>返回A页面</a>手里没有现成的例子,大概给你写了这些,应该就是这样的。
或者session也可以,用完就remove。
这是源码。a.htm<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_openBrWindow(theURL,winName,features) { //v2.0
window.open(theURL,winName,features);
}
//-->
</script>
</head><body>
<form name="form1" method="post" action="">
<table width="400" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="94"> </td>
<td width="306"> </td>
</tr>
<tr>
<td> </td>
<td><input name="text" type="text" id="text"></td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td><input name="Submit" type="button" onClick="MM_openBrWindow('/b.htm','','scrollbars=yes,width=300,height=400')" value="打开新窗口"></td>
</tr>
</table>
</form>
</body>
</html>
b.htm<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
</head>
<script>
function returnText() {
window.opener.form1.text.value=form1.text.value;
window.close();
}
</script><body>
<table width="100%" height="300" border="0" cellpadding="0" cellspacing="0">
<tr>
<td align="center"><form name="form1" method="post" action="">
<input name="text" type="text" id="text" value="请输入你的内容">
<br/>
<input type="button" name="Submit" value="关 闭" onClick="returnText()">
</form>
</td>
</tr>
</table>
</body>
</html>
这是网址http://community.csdn.net/Expert/topic/3170/3170466.xml?temp=.2616541
A 页面<% String tvalue = "";
try{
tvalue=request.getParameter("tvalue");
}
catch(Exception e)
{tvalue = "";}
%>
<form action="b.jsp" method="post">
<input type="text" name="atext" value="<%=tvalue%>" />
<input type="submit" value="提交" />
</form>b 页面
<% String tvalue = "";
try{
tvalue=request.getParameter("atext");
}
catch(Exception e1)
{tvalue = "";}
}
%>
<a href = A.jsp?tvalue =<%=tvalue%>>返回A页面</a>