Web Development with JavaServer Pages

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

For example, the control layer might determine that the requested URL is protected by access control, in which case it would forward the request to a logon page if the user has not yet been authenticated. This is an example of presentation logic controlling the application’s flow from screen to screen. If any application work needs to be done, the application’s presentation logic will collect data from the request, if necessary, and deliver it to the application logic tier for processing. When the application logic has completed its operation, the controller directs the request back to the user via the presentation layer.

10.1.1 Web application flow

Applications, no matter the platform, are designed with a particular flow in mind. Operations are expected to unfold in a series of steps, each with a specific purpose and each in an order anticipated by the application’s designer. For example, to edit a user’s profile you might prompt for a username whose profile you wish to edit, display that user’s current profile information, ask for changes, process those changes, and then display or confirm the results of the operation. As programmers, we expect the user—indeed require the user—to proceed through each part of the application in a certain, predetermined order. We can’t, for example, display user profile details without first selecting the username. The nature of the web however, can disrupt the rigid flow we’ve come to expect from applications.

Unlike traditional applications, web-based programs are forced to deal with strange interruptions that may occur in the expected flow of a program due to the inherent stateless request/response behavior of the HTTP protocol. The user can hit the Back button on the browser, hit reload, prematurely abort an in-process request, or open new browser windows at any time. In an application involving transactions, the application may require that certain activities happen under very specific circumstances or after certain prerequisites have been met. For example, you can’t save a modified entry until you have first retrieved the original from the database; you can’t delete an item until you have confirmed your selection; you can’t submit an order twice, and so forth.

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