我想做一个查询
这个是我的处理查询的网页 网页运行没有问题 但是没有显示出想要的信息 用jsp写的
<%@pagelanguage="java"%>
<%@ page import = "java.util.*" %>
<%@page import="java.sql.*" %>
<%@ page import = "bookstore.*" %>
<%@page pageEncoding="UTF-8" %>
<html>
<head></head>
<body>
<h1><font size = "7" face="华文行楷">安格丽特的书架</font></h1>
<hr>
<h2>书籍查询结果页面</h2>
<h3>查询结果:</h3>
<%
Connection cnnn =Util.getConnection();
Statement stmt=cnnn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_UPDATABLE);
String tit =request.getParameter("title");
String id;
String author;
String pub;
String price;
String sqlstr="select id,title,author,pub,price from books where title='"+tit+"'";
stmt.executeQuery(sqlstr);
ResultSet rs=stmt.executeQuery(sqlstr);
while (rs.next()){
id=rs.getString("id");
tit=rs.getString("title");
author=rs.getString("author");
pub=rs.getString("pub");
price=rs.getString("price");
System.out.println(id+""+tit+""+author+""+pub+""+price);
}
cnnn.close();
%>
<a href="search.jsp"> 返回查询页面 </a>
<br>
<a href="index.jsp">返回主页</a>
</body>
</html>
这个试运行的结果
求指点 怎样才能让数据库里的信息显示出来
是这样么 不过变成这样了...
好久没有在页面写Java代码,好不习惯 应该是这样子的吧。