<%@page language="java" import="java.sql.*"%> <%! Driver driver = null; String dbURL = null; Connection conn = null; Statement stat = null; ResultSet rs = null; Object rsValue = null; int counter; %> <% try { driver = (Driver) Class.forName("org.hsqldb.jdbcDriver").newInstance(); dbURL = "jdbc:hsqldb:" + application.getRealPath("/~polykandriotis/poly/poly"); conn = DriverManager.getConnection(dbURL,"sa", ""); stat = conn.createStatement(); rs = stat.executeQuery("SELECT * FROM guest"); } catch (Exception e) { out.print("Unable to make connection to guestbook"); out.print(e); } %>

Yianni's Guestbook

Please leave your comments on this site for Yianni.

Write a new guestbook entry

<% counter = 0; while (rs.next()) { %>

<% } %>
Entry no. <%= ++counter %> Name:
<%=(((rsValue = rs.getObject("name"))==null || rs.wasNull())?"":rsValue)%>
Email: <%=(((rsValue = rs.getObject("email"))==null || rs.wasNull())?"":rsValue)%>
Comments:
<%=(((rsValue = rs.getObject("message"))==null || rs.wasNull())?"":rsValue)%>
<% rs.close(); stat.close(); conn.close(); %>