Java Reference
In-Depth Information
L ISTING 7.5 Continued
}
}
catch (SQLException sqle) {
System.err.println(sqle.getMessage());
}
catch (ClassNotFoundException cnfe) {
System.err.println(cnfe.getMessage());
}
catch (Exception e) {
System.err.println(e.getMessage());
}
finally {
try {
if ( con != null ) {
// Close the connection no matter what
con.close();
}
}
catch (SQLException sqle) {
System.err.println(sqle.getMessage());
}
}
out.println(“</body></html>”);
out.close();
}
//Get Servlet information
public String getServletInfo() {
return “TitleListServlet Information”;
}
}
All the action in the TitleListServlet is taking place in the doPost() method. It first gets the
search_string passed in the request on the URL. The next steps involved are opening a con-
nection to the database, performing a query using the search_string , displaying the results,
Search WWH ::




Custom Search