Web Development with JavaServer Pages

Скачать в pdf «Web Development with JavaServer Pages»


In a traditional, off-line application, the developer has full control over the program flow. Each step in the application’s process logically flows through the program. A JSP application is a different story all together. Web applications are vulnerable to irregularities in the program flow. We’re not talking malicious intent; it’s a perfectly innocent action on the part of users, conditioned to browsing traditional web pages. They may bookmark the application halfway through the process, or may click the Back in an attempt to go back to a step in the application. Or, they may abort the request prematurely or attempt to reload the page. In any case, they break the program flow we might normally expect. It is the responsibility of the JSP application to ensure that proper program state and application flow is maintained.

10.1.2    Architectural approaches


Possibly the biggest choice you face in designing a JSP application is determining how to separate the responsibilities of presentation, control, and application logic. There are two basic approaches to take when architecting a JSP application: pagecentric and servlet-centric.


In the first approach, control and application logic responsibilities are handled by the JSP pages themselves; in the second, an intermediate servlet (or servlets) are used. Cleanly separating a JSP application into presentation, control, and application logic subsystems makes it easier to develop, understand, and maintain.

10.2    Page-centric design


In the page-centric approach an application is composed solely of a series of interrelated JSP pages that handle all aspects—the presentation, control, and the application logic. In this approach client requests are handled directly by JSP pages that perform whatever tasks are necessary, including communicating with back-end data sources, performing operations, and generating dynamic content elements.

Скачать в pdf «Web Development with JavaServer Pages»