Visual Mining contact us | site map | search

Products Solutions Resource Library Services Customers Partners Developers Company
Developers

About Java Servlets


On the About Java Applets page, we mentioned that applets are generally downloaded from a Web server and run on your computer by a Java-compatible Web browser, such as Netscape Navigator or Microsoft Internet Explorer. A Java servlet, in contrast, is a Java applet that runs on a web server to facilitate interactivity on your web site.

The Benefits of Using Java Servlets

Java servlets are becoming increasingly popular with web site developers as an alternative to CGI programs. One of the main reasons and greatest difference between the two is that the Java servlet is persistent. This means that once it is started, it stays in the server machine's memory and can fulfill multiple requests. In contrast, a CGI program turns off once it has fulfilled a single request. The persistence of Java servlets makes them faster because there is no time wasted in continually starting and stopping the program.

Java servlets also allow one to do several things that are difficult or impossible with regular CGI:

  • Servlets communicate directly with their web server, and regular CGI programs can't. Direct communications simplifies operations that need to look up images and other data stored in standard places.
  • Servlets share data amongst themselves, making useful things like database connection pools easy to implement.
  • Servlets maintain information from request to request, simplifying tasks such as session tracking and caching of previous computations.
  • Servlets are portable to any server computer that can run Java, as well as being inexpensive and convenient. They have become the Java platform technology of choice for extending and enhancing web servers.

JSP and Server-Side Interactivity

When web sites interact with their users over the entire duration of a session—such as in on-line stores—they are using server-side programming to accomplish this. As we noted above, Java servlets easily provide the foundation for such programming.

A servlet, in simple terms, is a Java program running under a web server. Servlets take a 'request' object as an input and returning a 'response' object as output. This is very similar to how the web servers themselves respond to HTTP requests from web browsers. Thus, by design, web developers can create and control interaction with the servlets by writing JavaServer Pages This is the same way that developers use ASP or Cold Fusion for interacting with servers.

JavaServer Pages (JSP) combine HTML with XML-like tags and scriptlets written in the Java programming language, which encapsulate the logic that generates the content for the page. Alternatively (or in addition), the application logic may be put into the servlets that the page accesses with these tags and small scripts. Any and all formatting (HTML or XML) tags are passed directly back to the response page, which is sent to the client browser. By thus separating the page's logic from its design and display, and by supporting a reusable component-based design, JSP technology makes it faster and easier than ever to build web-based applications.

JSP and Java servlets allow developers to dynamically generate web content in applications such as these:

  • On-line publishing systems
  • Flight reservation systems
  • Marketing software that gathers customer profiles and individualizes customer communications
  • Recruiting and personnel tracking systems
  • Media delivery on-line
  • Voice-response systems for e-commerce
  • Web-based marketplaces
  • Dynamic graphics generation

Dynamic Graphic Applications with Java Servlets

Visual Mining's NetCharts Server, itself a Java program, generates and delivers dynamic graphics or applets on demand. NetCharts Server operates in an architecture where it lies "behind" the web server and is controlled by a Java servlet. This configuration has the advantage of being fast and modular as well as secure. The disadvantage is that it requires a more sophisticated server setup than the average web site, and some experience to configure.

Example Graphics

NetCharts Server delivers the same charts and graphs as the NetCharts applets do. Please visit our Graphing Examples section here on this web site to see what charts NetCharts Server can deliver for you.

© 2008 Visual Mining, Inc. All rights reserved.
1-800-308-0731 | info@visualmining.com | privacy statement | legal
15825 Shady Grove Rd., Suite 20, Rockville, MD 20850 USA

Quote: Transaction Design, Inc