Java Reference
In-Depth Information
public void doGet(
HttpServletRequest request,
HttpServletResponse response)
throws ServletException, IOException {
performTask(request, response);
The rest of the controller is just like our previous examples. Our command
bean has changed slightly. Our board attribute is a single string instead of a
vector, with a new set method and a revised get :
protected String board = null;
public String getBoard() {
return board;
The execute must change to reflect the modified query and the revised
attribute type. Only the differences are shown here:
public void execute() {
result =
"SELECT subject, author, board from posts where board = '"
+ getBoard() + "'");
while ( {
So far, this balloon is flying smoothly. We have addressed our separation of
concerns and stayed true to our base design pattern. Listing 4.2 contains the
revised JSP . Unfortunately, we are in for a hard landing. This response set is
just like our last, with an additional page for a not-found condition.
Listing 4.2
The compound JSP processes decisions in the JSP
<jsp:useBean id="CompoundJSPCommand" class="bbs.CompoundJSPCommand"
<% if (CompoundJSPCommand.getSize() == 0) { %> B Decision 1
<TITLE>Choose another board! </TITLE>
Search WWH ::

Custom Search