How the Business Team supports the web designers when the MVC components are running on one JVM

As long as the business guys keep the interfaces to their model components consistent, everyone will be happy. The two key interface points in their design are when the controller first interacts with a model component (steps 1 and 2 below), and then later, when a JSP view interacts with the bean it needs (steps 3 and 4 below).

Getting customer data for a client...

image with no caption

1 Having received a request for customer information, the Controller calls the ManageCustomer service component (a Model). The service component does a JDBC call to the legacy database, then creates a Customer bean (this is NOT an EJB, just a plain old JavaBean), populated with customer data from the database.

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

3 The Controller forwards to the View JSP. The JSP gets the 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.

Get Head First Servlets and JSP, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.