日期:2014-05-18  浏览次数:20746 次

在jsp中创建了2个iframe,想在其中一个iframe提交数据(查询),在另外一个iframe显示查询结果。应该怎样做?
在jsp中创建了2个iframe,想在其中一个iframe提交数据(查询),在另外一个iframe显示查询结果。应该怎样做?提交数据用按钮实现,想另一个iframe同时实现显示结果

------解决方案--------------------
在提交页的form属性上添加target值
------解决方案--------------------
不难
帮你写了一段代码


<html>
<head>
<title> 好好学习!!
</title>
</head>
<body>
<from name= "form1 " action= "1.html ">
<p align=left> <iframe src= "1.html " width= "20% " height= "100% " scrolling= "no " bgcolor= "red " frameborber= "1 " align=left>
</iframe>
<input type= "text " name= "text1 ">
<input type= "button " value= "sure ">
</form>
</body>
</html>

------解决方案--------------------
main.jsp:
<html>
<head>
<meta http-equiv= "Content-Type " content= "text/html; charset=GBK ">
<title> Insert title here </title>
</head>
<body>
<frame>
<iframe name= "query " src= "query.jsp "> </iframe>
<iframe name= "list "> </iframe>
</frame>
</body>
</html>

query.jsp:
<html>
<head>
<meta http-equiv= "Content-Type " content= "text/html; charset=ISO-8859-1 ">
<title> Insert title here </title>
</head>
<body>
<form action= "list.jsp " method= "post " target= "list ">
<input type= "text " name= "theName ">
<input type= "submit " value= "Submit ">
</form>
</body>
</html>


list.jsp:
<html>
<head>
<meta http-equiv= "Content-Type " content= "text/html; charset=ISO-8859-1 ">
<title> Insert title here </title>
</head>
<body>
<%String result=request.getParameter( "theName "); %>
<%=result %>
</body>
</html>