Java Reference
In-Depth Information
JSP
if (command.x = a){
Command
HTML for a
else if (command.x = b){
Servlet
HTML for b
}
Client
HTML
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.
4.3.2
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
JSPs
Description
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
difficult.
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
screens.
Lack of common error treat-
ments
Users like common error windows and treatments. This design
makes it more difficult to include these.
Search WWH ::




Custom Search