jsp查询页面和结果页面在同一页面显示和交互

用frameset实现查询页面和结果页面在同一页面

用target实现交互显示在同一页面上

请参照以下方法解决:

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> 

 

posted @ 2015-08-30 21:17  zzlp  阅读(2246)  评论(0编辑  收藏  举报