jsp 与MYSQL来连接
<%@pagelanguage="java"import="java.util.*"import="java.sql.*"pageEncoding="GB2312"%><...
<%@ page language="java" import="java.util.*" import="java.sql.*" pageEncoding="GB2312"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>我的收藏</title>
</head>
<jsp:include page="header.jsp"/>
<body>
<jsp:useBean id="favour" scope="page" class="ibook.QueryUpdate"/>
<center>你好!</center>
<%
ResultSet rs=null;
String query=null;
session.setAttribute("login","true");
session.setAttribute("userid","1");
int userid=Integer.parseInt((String)session.getAttribute("userid"));
%>
<% if((String)session.getAttribute("login")=="false") out.println("你还没有登录!");
if((String)session.getAttribute("login")=="true"){
query="select distinct(book.bookid),title,author,price,Storage from book,webuser,favourite where favourite.userid=1 and favourite.bookid=book.bookid";
rs=favour.executeQuery(query);
//if(rs==null)out.println("<h4>你还没有收藏任何书籍!</h4>");%>
<table width="754" border="1" align="center" height="10">
<tbody><tr>
<td>书名</td>
<td>作者</td>
<td>价格</td>
<td>库存</td>
<td>购买</td>
<td >删除<br></td></tr>
<%while(rs.next()){
out.println("<tr>");
out.println("<td"+rs.getString("title")+"/td>");
out.println("<td"+rs.getString("author")+"/td>");
out.println("<td"+rs.getString("price")+"/td>");
out.println("<td"+rs.getString("Storage")+"/td>");
out.println("</tr>");
}
}
%>
</tbody></table>
</body>
<jsp:include page="tag.jsp"/>
</html>
??query在mysql中查询有一条记录,在这就啥也没有了??? 展开
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>我的收藏</title>
</head>
<jsp:include page="header.jsp"/>
<body>
<jsp:useBean id="favour" scope="page" class="ibook.QueryUpdate"/>
<center>你好!</center>
<%
ResultSet rs=null;
String query=null;
session.setAttribute("login","true");
session.setAttribute("userid","1");
int userid=Integer.parseInt((String)session.getAttribute("userid"));
%>
<% if((String)session.getAttribute("login")=="false") out.println("你还没有登录!");
if((String)session.getAttribute("login")=="true"){
query="select distinct(book.bookid),title,author,price,Storage from book,webuser,favourite where favourite.userid=1 and favourite.bookid=book.bookid";
rs=favour.executeQuery(query);
//if(rs==null)out.println("<h4>你还没有收藏任何书籍!</h4>");%>
<table width="754" border="1" align="center" height="10">
<tbody><tr>
<td>书名</td>
<td>作者</td>
<td>价格</td>
<td>库存</td>
<td>购买</td>
<td >删除<br></td></tr>
<%while(rs.next()){
out.println("<tr>");
out.println("<td"+rs.getString("title")+"/td>");
out.println("<td"+rs.getString("author")+"/td>");
out.println("<td"+rs.getString("price")+"/td>");
out.println("<td"+rs.getString("Storage")+"/td>");
out.println("</tr>");
}
}
%>
</tbody></table>
</body>
<jsp:include page="tag.jsp"/>
</html>
??query在mysql中查询有一条记录,在这就啥也没有了??? 展开
展开全部
sql有问题吧,至少webuser表都没用到森逗呀。
建议把sql放到mysql里执山中行下,就知道sql写的对不逗春山对了
建议把sql放到mysql里执山中行下,就知道sql写的对不逗春山对了
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
out.println("<td"+rs.getString("title")+"/td>");
out.println("<族液衡td"+rs.getString("author")+"/td>");
out.println("<td"+rs.getString("price")+"/td>");
out.println("<td"+rs.getString("Storage")+"/td>");
改成
out.println("<td>"+rs.getString("埋仔title")+"</td>"兆做);
out.println("<td>"+rs.getString("author")+"</td>");
out.println("<td>"+rs.getString("price")+"</td>");
out.println("<td>"+rs.getString("Storage")+"</td>");
out.println("<族液衡td"+rs.getString("author")+"/td>");
out.println("<td"+rs.getString("price")+"/td>");
out.println("<td"+rs.getString("Storage")+"/td>");
改成
out.println("<td>"+rs.getString("埋仔title")+"</td>"兆做);
out.println("<td>"+rs.getString("author")+"</td>");
out.println("<td>"+rs.getString("price")+"</td>");
out.println("<td>"+rs.getString("Storage")+"</td>");
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询