O'Reilly logo

Head First Servlets and JSP, 2nd Edition by Bert Bates, Bryan Basham, Kathy Sierra

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Protecting the web designer’s JSPs from remote model complexity

By using the Business Delegate and Service Locator patterns, we’ve got Rachel’s controllers protected from the complexities of remote model components. Now let’s see if we can do the same for the web designer’s JSPs.

Quick review of the old non-remote way— the JSP uses EL to get info from the local model.

This diagram should look familiar from earlier in the chapter. The JSP gets the bean reference from the request object (step 3), then calls getters on the bean (step 4).

image with no caption

1 Having received a request for customer information, the Controller calls the ManageCustomer model component. The model component does a remote call to the legacy database, then creates a Customer bean, populated with customer data from the database.

2 The Controller adds the Customer reference to the request, as an attribute.

3 The controller forwards to the View JSP. The JSP gets a reference to the Customer bean from the request object.

4 The View JSP uses EL to get the Customer Bean properties it needs to satisfy the original request.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required