JSP - Servlets: Development Environment

This figure shows the two development environments of ASP.NET and JSP/Servlets. We will be explaining the first eight layers, of the right half of the figure representing JSP and Servlets.

The first eight layers are:

  1. Operation System
  2. Web Server
  3. Application Server
  4. Java Runtime Environment
  5. J2EE Class Library
  6. JDBC
  7. Servlet
  8. JSP

Since java is known to be platform independent; J2EE application servers were built in a way that can run on a variety of operating systems. This adds a lot to J2EE abilities; but on the other hand, it adds a lot of over head and complexity.

For this variety of OS that can be used, abstraction is needed which forces a restriction on the quantity of OS features that will be accessed.

Learn more about OS from MSDN at http://msdn.microsoft.com/en-us/library/aa478961.aspx

A web server is mainly responsible for serving pages for viewing in the web browser through handling the HTTP requests. On receiving the HTTP request from the user, it sends the HTTP response with the HTML page (either static HTML page, image) while for the dynamic web pages it delegates the dynamic response generator programs (CGI scripts, JSPs, ASPs) to produce a response –often in HTML- to be viewed at the user's web browser.

Learn more about a Web Server from java world at http://www.javaworld.com/javaqa/2002-08/01-qa-0823-appvswebserver.html

It's basically the server program that provides the access to business logic for the use of client's applications.

It might be considered to be a part of the three tiered architecture that includes the Client Tier, Middle Tier and the Enterprise Information System Tier. Client tier represents the presentation level (graphical user interface). The Middle Tier represents the collection of business logic applications which are the combination of web containers and the EJB containers (web container is the java equivalent to the CGI scripts where the java code is executed). Finally, the EIS Tier that represents the database and transaction server.

Learn more about Application servers from java world and RoseIndia at http://www.javaworld.com/javaqa/2002-08/01-qa-0823-appvswebserver.html , http://www.roseindia.net/ejb/application-server.shtml

The application needs to run over a runtime engine; which is responsible for compiling the code and providing other critical services such as memory management.

As mentioned earlier, the J2EE run time environment was designed supporting portability between different OS, this limits its performance.

Learn more about Java Runtime from MSDN at http://msdn.microsoft.com/en-us/library/aa478961.aspx

J2EE and J2SE class libraries contain around 135 packages, divided along a variety of base package groups (java, javax and org). These libraries are fully functional, and continually expanding. This expansion has added complexity and often ambiguity. (For example when to use different packages: org.xml or java.xml for XML access).

Learn more about J2EE from MSDN at http://msdn.microsoft.com/en-us/library/aa478961.aspx

JDBC is the library that supports database connection between Java and different database management systems. The java JDBC supports a very traditional way in data accessing; the user submits a statement (often a "query" or "calling a stored procedure"), and receives the result in form of a result set ("a table" and its "meta Data", that is data about data). The database calls and results depend on an open connection at all times.

JDBC does not directly support reading or writing XML data. Although several vendors have created JDBC wrappers for XML-based database access, the core J2EE classes do not support it.

Learn more about JDBC from MSDN at http://msdn.microsoft.com/en-us/library/aa478961.aspx

Servlets are an underlying technology behind Java Server Pages. They allow programmers to work directly with requests made to a Web server and to form responses that include content that is returned to a client. Unlike JSPs, which are oriented toward presentation because of their combination with HTML; servlets are composed entirely of Java, which makes them greater in performing lower-level functions, working with data and implementing business models.

You can say that, simply a servlet is a Java class implementing the javax.servlet.Servlet interface that runs within a Web or application server's servlet engine, serving client requests forwarded to it through the server.

Read more about servlets from sun at: http://java.sun.com/developer/technicalArticles/Programming/jsp/

Basically, a JSP page is simply an HTML web page, containing additional bits of code that execute application logic to generate dynamic content. The embedded Java code is executed on the server before the page is returned to the browser (The elements in a Java Server Page will generally be compiled by the JSP engine into a servlet). It enables rapid development of web-based applications that are platform-independent. In addition, it separates user interfaces from content generation, enabling designers to change the overall page layout without altering the underlying dynamic content.

Read more about JSP from devx and sun at: http://www.devx.com/tips/Tip/25217, http://java.sun.com/developer/technicalArticles/Programming/jsp/

RenewSession