Web Development in J2EE Using the MVC Design Pattern
(Page 1 of 5 )
Web services application development is a huge topic covering a broad range of technologies and topics. In this article we will discuss Web services development in J2EE and examine the Model/View/Controller design pattern, thereby explaining how it separates business logic implementation and persistence from presentation. We shall briefly introduce the Struts Framework, one that facilitates web services development within the IBM WebSphere Studio Application Developer edition. (This article was originally published in the June 2004 issue of Plug-In).
What is a Web service? The question is perhaps best answered by first describing what a Web service is not. It is not a subscription service but rather represents Web server business logic processing. Web service fundamentals always require immutability, whereas flexibility lies in the approach used to develop the Web service. Typically, in the Java world, a Web server resides in a container such as IBM’s WebSphere Application Server and provides low-level services such as automatic memory management, garbage collection, and connection pooling. WebSphere’s “Studio Application Development” tools support many Apache open-source tools, including the Jakarta Struts framework. The overall WebSphere Application Server (WAS/WSAD) architecture is component-based and layered in multi-tiers. Let’s examine the infrastructure as demonstrated in the following illustration:

J2EE Component Containers
This illustration demonstrates how the WSAD infrastructure is layered in five tiers. The presentation layer contains the Java application, HTML, JSP pages, and XML technologies to return responses to the client. Notice how the Web services component is also part of this tier. The Controller/Mediator tier encapsulates Java Servlet, Struts Framework, JavaBeans, and MSG Driven Bean technologies. The Domain layer contains the business logic whereas the mapping layer utilizes container managed EJBs and Bean Managed Persisted EJBs to implement business rule-driven tasks. Persistence to a relational database such as SQL Server 2000 uses JDBC drivers to achieve cross-platform interoperability.
The Web keyword indicates how service provider functionality is exposed to the client and occurs on a server residing somewhere on the Internet. The event is typically a response to client requests. To be more specific, the event requires a handler to forward requests to a Web server where a mediator object (a servlet functioning as a MVC controller) intercepts client requests, interprets the messages, and forwards them to an appropriate object (EJBs or JavaBeans) for processing. Ultimately, a response is returned to the client via a Web-compliant browser, an ASP.NET page, or a Java Server Page (JSP).
Next: Examining Servlets and Java Server Pages >>
More Java Articles
More By Dwight Peltzer