关于如何将一个结果集显示到另一个页面的方法
麻烦懂的人帮个忙,就是我现在在一个页面上做了一个查询按钮,搜索数据库的与句也写好了,关于最后结果集,我想实现这个结果集在另一个页面的表里显示出来!请会的人指导一下!代码如下:
<%@ page language="java" import="java.util.*,java.sql.*" pageEncoding="gb2312"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<title>My JSP 'index.jsp' starting page</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->
</head>
<body>
<form id="form1" name="form2" method="post"action="Message.jsp">
<label>
<input type="submit" name="Submit" value="留言板" />
</label>
<%
Class.forName("com.mysql.jdbc.Driver");
String url = "jdbc:mysql://localhost:3306/myweb?useUnicode = true&characterEncoding = gb2312";
String username = "root";
String password = "123456";
Connection conn = DriverManager.getConnection(url, username, password);
String message = request.getParameter("message");
String sql = "select * from bleach where message like '%" + message + "%'";
PreparedStatement p = conn.prepareStatement(sql);
ResultSet rs = p.executeQuery();
session.setAttribute("rs",rs);
%>
</form>
</html>
[ 本帖最后由 hxazyq1 于 2012-11-21 14:49 编辑 ]