<%@ page import="org.w3c.tools.jdbc.*" %>
<%@ include file="config.jsp" %>
<!-- initialize moviebean and specify the table name "movies" -->
<jsp:useBean id="moviebean" class="MovieBean" scope="request">
    <%
        JdbcBeanUtil.initializeBean(configbean, moviebean, "movies");
    %>
</jsp:useBean>
<!-- set properties -->
<jsp:setProperty name="moviebean" property="*" />

<!-- html starts here -->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
  <head>
    <title>Add Movie</title>
  </head>
  <body>
    <h1>Add Movie</h1>
<%
    if (request.getMethod().equals("POST")) {
       if (moviebean.getSerializer().insert()) {
%>
     Movie added!
<%
       } else {
%>
     SQL Error.
<%
    } else {
%>
    <form method="POST">
       <table border="0">
       <tr>
       <td>Title : </td><td><input type="text" name="title"></td>
       </tr><tr>
       <td>Director: </td><td><input type="text" name="director"></td>
       </tr><tr>
       <td>Year : </td><td><input type="text" name="year" size="4"></td>
       </tr><tr>
       <td colspan="2"><input type="submit"></td>
       </tr>
       </table>
    </form>
<%
    }
%>
  </body>
</html>
