[ Team LiB ] |
A.1 Architectural Patterns
Also Known As Decorating FilterGoalDynamically add functionality to the front controller (Figure A-1). Figure A-1. Classes in the Decorator patternParticipants
InteractionsThe decorator intercepts all requests destined for target and performs a common function such as logging or decryption. The decorator then forwards the request to the next decorator in the chain, or the target if there are no more decorators. NotesIn the J2EE presentation tier, decorators are typically implemented as servlet filters with a servlet as the target. Note that filters have a slightly different API than servlets.
GoalCreate a single, central component to perform common functions (Figure A-3). Figure A-3. Classes in the Front Controller patternParticipants
InteractionsThe front controller intercepts all requests and performs common functions such as logging or decryption. The front controller chooses and forwards the request to a page controller. The page controller parses user input, and translates it into appropriate updates to the model. The model applies business rules and stores the data persistently, either locally, in the business tier, or using some other remote persistence mechanism. Based on the model changes and user input, the page controller chooses a view. The view transforms the updated model data into a form suitable for the user. NotesIn J2EE, the front controller is typically implemented as a servlet, although in some cases it may be implemented as a servlet filter.
Also Known AsMVC, Model 2 GoalSeparate presentation tier into self-contained, reusable pieces (Figure A-5). Figure A-5. Classes in the MVC patternParticipants
InteractionsThe controller receives the user input, and translates it into appropriate updates to the model. The model applies business rules and stores the data persistently, either locally, in the business tier, or using some other remote persistence mechanism. Based on the model changes and user input, the controller chooses a view. The view transforms the updated model data into a form suitable for the user. NotesIn J2EE, the model is typically implemented as JavaBeans or EJBs. The views may be JSPs, static HTML pages, or even servlets. The controller is usually a servlet. |
[ Team LiB ] |