<%@page import="java.sql.*"%>
<html>
<head><title>Intranet Shop</title></head>
<body>
<h1>Intranet Shop</h1>
<form action="availability.jsp" method="post">
<table>
<%
String rpcRouter = request.getParameter("rpcrouter");
if(rpcRouter == null)
    rpcRouter = "http://localhost:5401/soap/servlet/rpcrouter";
%>
<tr><td valign="top">Wholesaler URL:</td>
    <td valign="top"><input type="text" name="rpcrouter"
        size="50" value="<%= rpcRouter %>"></td></tr>
<tr><td valign="top">Product:</td>
    <td valign="top"><select name="productid" size="5">
<%
new org.hsqldb.jdbcDriver();
Connection connection =
    DriverManager.getConnection("jdbc:hsqldb:db/reseller",
                                "sa",
                                null);
try {
    Statement stmt = connection.createStatement();
    try {
        ResultSet rs = stmt.executeQuery("select id," +
                                     "description from product");
        while(rs.next()) {
%>
    <option
      value="<%= rs.getInt(1) %>"><%= rs.getString(2) %></option>
<%
        }
    }
    finally {
        stmt.close();
    }
}
finally {
    connection.close();
}
%>
</select></td></tr>
<tr><td valign="top">Quantity:</b></td>
    <td valign="top"><input type="text" name="qty"
     value="1"></td></tr>
</table>
<input type="submit" value="When can we ship?">
</form>
</body>
</html>
