Java Reference
In-Depth Information
while (rs.next()) {
out.println("<TR>");
String subject = rs.getString(1);
String author = rs.getString(2);
String board = rs.getString(3);
H Model and
view logic
H Model and
view logic
out.println("<TD>" + subject + "</TD>\n"
out.println("<TD>" + author + "</TD>\n");
out.println("<TD>" + board + "</TD>\n");
out.println("</TR>");
}
rs.close(); I Model and view logic
stmt.close();
connection.close();
I Model and
view logic
out.println("</TABLE>");
out.println("</body>");
} catch (Throwable theException) {
}
}
B The response writer is traditional view logic that establishes the result set and gets
a writer to create the output result.
C This print statement contains traditional view logic that prints the HTML header
to the output set.
D This database connection initialization is traditional model logic that initializes the
class that establishes the connection to the database. Note that the database logic is
right up against the view logic.
E In this traditional model logic, we establish the connection initialized earlier.
F Here we have more traditional model logic that runs the query and gets a result set.
G Once again, we switch back to view logic that prints table headings to the output
result.
H Here, things actually get worse! We first start a result set, then print our HTML
table headings, and then start to iterate through the result set.
I This model and view logic cleans up.
To continue with the listing, we will process the methods required to process
the HTTP GET :
public void doGet(
HttpServletRequest request,
Search WWH ::




Custom Search