Java Reference
In-Depth Information
if (command.x = a){
HTML for a
else if (command.x = b){
HTML for b
Figure 4.1 One solution to handling multiple conditions for a servlet is to process the decision
in the JSP. The result is the antipattern called the Compound JSP . Some problems are poor
separation of concerns and limited reuse.
An example combining two interfaces
In the following example, we have a Compound JSP that stems from an error
condition. We will take our bulletin board example and modify it to return
only the posts for a user-specified board. We will need to add an input HTML
form so that the user can enter the name of the board, modify the command to
Table 4.2 Problems created by combining multiple user interfaces in a single JSP, called the
Compound JSP antipattern.
Problems with Compound
No separation of concerns
Combining code and HTML script makes it necessary to find peo-
ple with programming and designing skill. This is expensive and
Poor reuse
It is harder to reuse a compound view with built-in control logic.
Harder use of tools
Tools handle single-user interface screens better than multiple
Lack of common error treat-
Users like common error windows and treatments. This design
makes it more difficult to include these.
Search WWH ::

Custom Search