1 <jsp:useBean id="user" scope="session" class="obs.User"/>
2 <%@ page import=
"java.sql.*"%>
3
4 <h3>List Of Books </h3>
5
6 <table border=
1 width=100%>
7 <tr style=
"background-color:green;color:beige;font:700 10pt verdana">
8 <th>&nbsp;
9 <th>Serial No
10 <th>ISBN
11 <th>Title
12 <th>Price
13 <th>Author
14 <th>Cateogry
15 <th>Publisher
16 </tr>
17 <%
18    
19   String cond = (String) request.getAttribute(
"cond");
20   
if ( cond == null)
21      cond =
"1 = 1";
22  
23   Connection con = user.getConnection();
24   Statement st= con.createStatement();
25
26   ResultSet rs = st.executeQuery(
"select rownum,isbn,title,author,price,cat,pub from books where " + cond);
27
28   
while (rs.next())
29   {
30
31 %>
32 <tr>
33 <td>
34 <a href=addbook.jsp?isbn=<%=rs.getString(
"isbn")%>>Add TO Cart </a>
35 <td><%=rs.getInt(
1)%>
36 <td><%=rs.getString(
2)%>
37 <td><%=rs.getString(
3)%>
38 <td><%=rs.getString(
4)%>
39 <td><%=rs.getInt(
5)%>
40 <td><%=rs.getString(
6)%>
41 <td><%=rs.getString(
7)%>
42 </tr>
43
44 <%
45   }
46   rs.close();
47   st.close();
48   con.close();
49 %>
50
51 </table>
52
53
54
55
56
57   
58   


Gõ tìm kiếm nhanh...