Home arrow Java arrow Page 3 - Web Development in J2EE Using the MVC Design Pattern
JAVA

Web Development in J2EE Using the MVC Design Pattern


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).

Author Info:
By: Dwight Peltzer
Rating: 4 stars4 stars4 stars4 stars4 stars / 34
January 17, 2005
TABLE OF CONTENTS:
  1. · Web Development in J2EE Using the MVC Design Pattern
  2. · Examining Servlets and Java Server Pages
  3. · Java Server Pages (JSPs) Resolve Servlet Issues
  4. · Applying the Model/View/Controller Design Pattern
  5. · Applying the Mediator Design Pattern

print this article
SEARCH DEVARTICLES

Web Development in J2EE Using the MVC Design Pattern - Java Server Pages (JSPs) Resolve Servlet Issues
(Page 3 of 5 )

The introduction of Java Server Pages (JSPs) was developed to alleviate many of the problems encountered with Java Servlets.  JSPs are an extension to the Java Servlet technology. Stating it succinctly, a JSPís life cycle ends as a servlet so they are a natural fit when paired with servlets. JSP pages are text documents containing a .jsp extension, and represent a combination of static HTML and XML-designed tags and scriptlets. The tags and scriptlets encapsulate business logic and generate content for the pages. The .jsp files are processed and converted to Java class files, then subsequently executed indirectly by a Web container.
Many JSP advantages exist, including the following:

  • JSPs are compiled rather than interpreted, thereby enhancing performance.
  • JSPs support scripting and offer full access to the Java language.
  • JSPs can be designed as custom tags.

JSP Model 1 and Model 2 Architectures

Two separate JSP technological approaches exist for creating Web applications.

  • JSP Model 1 Architecture
  • JSP Model 2 Architecture

Several differences exist between the two technologies. The prime difference lies in how the request is processed. With Model 1 architecture, a single JSP manages all requests with responsibility for displaying and returning responses to the client. In contrast, the Model 2 architecture differs in that the request is intercepted by a servlet, herein now referred to as a controller servlet. This servlet manages incoming requests and makes the determination as to how to delegate the request to an appropriate Java Bean or Enterprise Java Bean for further processing. Upon completion of the given task, the servlet calls a specific JSP to return results to the client. Consider the following:

The client browser forwards a request directly to a JSP rather than a servlet. This preserves the concept of separating presentation from logic, whereas forwarding a request to a servlet does not. Sending a client request to a JSP allows the servlet to execute front-end processing such as user-authentication and authorization before forwarding the request to an object (Java Bean or EJB) for further processing. Upon completion, a JSP returns the results/response to the client. Notice how the Web server component utilizes servlets and Java Server Pages to process all client requests.


blog comments powered by Disqus
JAVA ARTICLES

- Java Too Insecure, Says Microsoft Researcher
- Google Beats Oracle in Java Ruling
- Deploying Multiple Java Applets as One
- Deploying Java Applets
- Understanding Deployment Frameworks
- Database Programming in Java Using JDBC
- Extension Interfaces and SAX
- Entities, Handlers and SAX
- Advanced SAX
- Conversions and Java Print Streams
- Formatters and Java Print Streams
- Java Print Streams
- Wildcards, Arrays, and Generics in Java
- Wildcards and Generic Methods in Java
- Finishing the Project: Java Web Development ...

Watch our Tech Videos 
Dev Articles Forums 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
Contact Us 
Site Map 
Privacy Policy 
Support 

Developer Shed Affiliates

 




© 2003-2017 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap
Popular Web Development Topics
All Web Development Tutorials