Java Reference
In-Depth Information
<HTML> C View specific HTML
<TITLE>Message Board Posts</TITLE>
<H1>All Messages</H1>
<TABLE border="1">
<% D Model specific database access
// Establish a connection
try {
Class.forName ("").newInstance();
// connect with default id/password
connection = DriverManager.getConnection (url);
// set and execute SQL statement
statement = connection.createStatement();
result = statement.executeQuery
("SELECT subject, author, board from posts");
// print the results
// retrieve data from the database and print on the result page
while ( {
out.println("<TR> <TD>" + result.getString(1) + "</TD>");
out.println("<TD>" + result.getString(2) + "</TD>");
out.println("<TD>" + result.getString(1) + "</TD></TR>");
} catch (Throwable theException) {
out.println("Connection or output print failed.");
</TABLE> E View specific HTML
Search WWH ::

Custom Search