Java Reference
In-Depth Information
C The next decision processes the not-found condition. We do not want to dedicate
too much screen real estate to conditions outside our main processing. We
conveniently transfer execution to a dedicated exception processor: Not-
FoundResults.jsp .
Next, we'll have two JSP s instead of one. Each is infinitely more readable than
listing 4.2. First, the expected case, returning all posts for a board:
<HTML>
<jsp:useBean id="CompoundJSPCommand" class="bbs.CompoundJSPCommand"
scope="request"></jsp:useBean>
<HEAD>
<TITLE>Message Board Posts</TITLE>
</HEAD>
<BODY BGCOLOR=#C0C0C0>
<H1>All Messages</H1>
<P>
<p>
Board: <%=CompoundJSPCommand.getBoard()%>
<TABLE border="1">
<TR>
<TD>Subject</TD>
<TD>Author</TD>
</TR>
<% for (int _i=0; _i < CompoundJSPCommand.getSize(); _i++) { %>
<TR> <TD><%=CompoundJSPCommand.getSubject(_i) %></TD>
<TD><%=CompoundJSPCommand.getAuthor(_i) %></TD>
</TR>
<% } %>
</TABLE>
<P>
</BODY>
</HTML>
Next, the JSP for the not-found condition:
<HTML>
<jsp:useBean id="CompoundJSPCommand" class="bbs.CompoundJSPCommand"
scope="request"></jsp:useBean>
<HEAD>
<TITLE>Choose another board! </TITLE>
</HEAD>
<p>
There were no posts for board <%=CompoundJSPCommand.getBoard()%>
<BODY BGCOLOR=#C0C0C0>
Search WWH ::




Custom Search