<%@ page language="java" import="java.util.*, java.sql.*, DBConnection2" %> <% // Prevent the browser from cacheing this page response.setHeader ("expires","-1"); DBConnection2 dbconn = null; int count = 1; try { dbconn = new DBConnection2(); }catch (Exception e) { System.out.println("Error getting DB Connection"); } ResultSet rs = dbconn.executeQuery("select * from ITEM where ITEM_TYPE = 'B'" ); %> JSP example

Book List

<% try { rs.next(); count++; rs.next(); String itemID = rs.getString("ITEM_ID"); String title = rs.getString("ITEM_TITLE"); String author = rs.getString("AUTHOR_ARTIST"); String qty = rs.getString("INV_QTY"); String price = rs.getString("UNIT_PRICE"); String imagefile = rs.getString("ITEM_IMAGE_FILE"); String desc = rs.getString("ITEM_DESC"); if( desc == null) desc = " "; %>
 <%= count++ %>. <%= title.trim() %>
by <%= author.trim() %>
<%= desc.trim() %>

 Our Price: $<%=price.trim() %>

 

<% }catch(SQLException sqlex){ System.out.println("Error creating Statement" + sqlex); } %>