Back to Papers and Articles
Active Server Pages (ASP), Java Server Pages (JSP), Cold Fusion (CFM) - A comparative analysis
Copyright 2000 Paragon Corporation   ( April 26, 2000)
Microsoft Active Server Pages, Sun's Java Server Pages and Allaire Cold Fusion are 3 popular and powerful standards for displaying active content on a web site. Each has its own style for achieving this end.

Microsoft Active Server Pages (ASP)

Active Server Pages is Microsoft's technology for deploying active content on the web. This technology was designed to work on a Windows Operating System that is running Microsoft Internet Information Server (IIS) (for NT Server) or Microsoft Peer Web Services (for NT Workstation, Win9x). It depends very heavily on Microsoft's COM/DCOM technology at least in a Windows operating environment.

ASP is a very mature technology compared to many others. It is currently in it's version 3 phase (ASP 3.0 - supported by IIS 5.0). ASP is a scripting framework. I say scripting framework rather than scripting language because while most people use Server Side VBScript and VBScript is the default scripting language for ASP when scripting ASP pages, one can in fact use Jscript, PerlScript or any other scripting language for that matter if that is supported on the server in a way that fits in the ISAPI model. The scripting language used can vary from page to page even within the same web application or page.

ASP 's approach is to provide an environment in which a script is executed on the server to retrieve user requests from a web page and generate active web content to satisfy the request and that the script used can utilize prefabricated components for more complex logic such as accessing data from a database, retrieving a binary file that a user is uploading, emailing, generating gifs etc. Script code can be combined with straight HTML.

In order to achieve this goal, ASP has a couple of built-in objects that are accessible from every ASP page from the server-side script. The main ones are listed below.
RequestUsed to retrieve information submitted by a form or passed in a URL query string
ResponseUsed to write content back to a page. Primarily for generation of html or redirecting to other web pages.
SessionUsed to store persistent information about a user. Sessions can only be supported if a browser is cookie enabled. Session variables are initialized in a Global.asa file.
ApplicationUsed to access persistent information about an application. Much of this information is set in a global.asa file.
ServerUsed most often to create instances of Server side components such as database connections and resultsets.
You will notice that most other web scripting environments contain counter parts to the above.

Below is pseudo code of how an ASP page looks

<%@ Language=VBScript %>
'**** - Server side functions etc. go here
Dim i

<% For i = 1 to 10 
'Writing  from 1 to 10 


Because of it's growing popularity, there have been ports of this to non-Windows operating systems and web servers such as Linux and Unix. The most popular of these is Chilisoft's ASP

In terms of required skill level to pick up, you will find that ASP sits in the middle between Java Servlets/JSP and Cold Fusion. For a programmer already proficient in Visual Basic and ADO technologies deploying a web application on a Windows environment, ASP will probably be the tool of choice.

Three main selling points for ASP is that

  • It is free if you already have a Windows-based computer.
  • It has got lots of support for common tasks such as database connectivity - it uses OLEDB/ODBC which has connection pooling built into it. Good OLEDB drivers for major dbs are usually available free of charge and many come included with IIS or can be downloaded from Microsoft's site. If you have IIS for NT Server, you get a built-in SMTP server easily accessible from Collaborative Data Objects for NT Server (CDONTS).
  • Because of its large install base - there are lots of free and relatively cheap components that can be plugged in for standard tasks such as automating user upload of files, emailing (there are a lot to choose from each taughting different functionality such as email queueing, ability to mail to news groups, include attachments etc), on the fly image generators.

Sun's Java Server Pages (JSP) and Servlets

Servlets and JSP are APIs developed by Sun to deploy web-based applications. Servlets came on the scene later than ASP and Cold Fusion therefore there are not as many components etc. available to the Java Servlet programmer. JSP came after Servlets to fill the gap between Java Programming and HTML design and scripting. Before JSP, Servlet programmers would have to embed out.println statements in there java methods to generate HTML output. JSP provided another option - embedding Java and Servlet (also other Java class) calls into an HTML document.

The relationship between JSP and Enterprise Java Beans (EJB) is analogous to ASP and COM/DCOM. JSP is like an ASP page and even borrows a lot from ASP technology. It allows a developer to easily write Static HTML content with embedded dynamic content by enclosing active content in <%  %> or <jsp:> tags. Active content is written in Java. It is advised that complex business logic be compartmentalized in EJB for better separation between design and functionality. The main difference between ASP and JSP is that in ASP active content is written with a scripting language while in JSP, active content is written in Java (not javascript). This makes it possible in JSP to write complex logic with complex error handling that may not be possible in ASP. In fact behind the scenes, JSP pages are compiled into Servlets.

While all this extra power may sound wonderful, it comes at a price. Java Servlets and JSP are well suited for people familiar with Java programming. To a non-Java programmer JSP can be very frustrating to debug and write. For example since active content in JSP is generated with Java, one needs to cast session and request variables into a usable format. This is not necessary in ASP scripting and Cold Fusion which do these translations transparently.

Below is a sample of what a JSP page looks like

<%@ page import = "java.sql.*" %>
<%@ page import = "java.util.Date" %>
<%@ page import = "myapplib.*" %>
int i = 0 ;
java.util.Date today = new java.util.Date();

<% (for i = 1; i <= 10; i ++){ 
//Writing  from 1 to 10 


Below are native objects available to a JSP page. Some of these are only available in JSP 1.0 and above.
requestUsed to retrieve information submitted by a form or passed in a URL query string
responseUsed to write content back to a page. Primarily for generation of html or redirecting to other web pages.
sessionUsed to store persistent information about a user. Sessions can only be supported if a browser is cookie enabled. Session variables are initialized in a Global.jsa file or in a Servlet.
applicationUsed to access persistent information about an application. Much of this information is set in a global.jsa file.

As shown above, both JSP and ASP use the <% %> to generate output interspersed control logic with HTML code. These tags are often mangled by unknowing HTML WYSIWIG editors which translate these to HTML encoded equivalents - thus making a JSP page or ASP page non-functional.

Main selling points for JSP/Servlets are

  • It is very cross-platform - one can find Servlet Engines for most operating systems and web servers although may take a bit of investigation to find the most suitable.
  • It is possible to create new tags to handle more sophisticated tasks.
  • Has all the control power of Java if one needs to exploit it.
  • It is possible to use servlets to build other language parsers. An interesting example of this is Livesoftware (now Allaire) CFMSerlvlet which comes with the most recent versions of JRUN Servlet Engine. This allows JRUN Servlet engine to process some Cold Fusion pages.

Cold Fusion

Allaire's Cold Fusion is a development and web server environment specifically designed for the web from the ground up. As a result of this most of the dynamic content generated by it is accomplished using XML type tags. Because Cold Fusion uses Cold Fusion Markup Language (CFML) tags to generate active web content, it is in general not mangled by HTML editors. HTML editors just view CFML tags as HTML tags not supported so simply ignore them.

Cold Fusion is by far the easiest language of the 3 to pick up and do useful things with. Most of the reason for this is that Cold Fusion has built in tags for the most common things that a web developer would want to do. For example it has a CFQUERY tag that simply requires an SQL statement and a connection string to generate a result set from a database. The SQL statement can contain in it CFML variables. Compare this to the number of lines you have to write in ASP and JSP to generate the same result. Also since ASP and JSP require calling external components - SQL statements are passed in as string arguments and most be concatenated etc. with ASP, JSP variables.

Cold Fusion like JSP can support custom tags. Custom tags can be created using control CFML pages. It also has the cabability to interact with external components such as Microsoft COM or CORBA components.

An article that does a good job of summing up the power of Cold Fusion is the April 2000 issue of SQL Server Magazine - (Link is shown at end of this article).

While Cold Fusion sounds like a great environment for web development, it is not for everyone or for every task. Because it is tag-based, it is harder to do complex control statements in it than it is to do such tasks in ASP and JSP/Servlets. This is not to say that you can't. For people that come from more of a programming than a web design background, using CFML tags for control flow may seem a little bit foreign as well and not worth the effort to learn.

Compare Chart

Below is a chart of how we rate each of the 3 offerings. 1 being the best in that category and 3 being the worst.

EnvironmentEase of Use/HTML Integration Support for Databases Cross-Platform Support Upfront Costs Extended Costs
Cold Fusion12231

Ease of Use/HTML Integration
Cold Fusion integrates best with HTML because it looks very similar to HTML. This makes it easy for web designers to change the design of web pages without too much concern about mangling dynamic content. For very common tasks such as querying a database, Cold Fusion has simple to use built-in constructs.
Support for Databases
This was a tough choice. Cold Fusion's support for databases is fairly good. It has built-in connection pooling, cached- data support, support for ODBC, OLEDB and other formats using its WDDX library. ASP 2/3.0 we ranked slightly higher. From experience ActiveX Data Objects (ADO) components are easier to access in ASP and performance is generally better than Cold Fusion's ODBC implementation. Also with the new ASP 3.0 and ADO there is support for hierarchical recordsets and saving data in XML format.

We ranked Java's JDBC (primarily what is used by Java for connecting to databases) last. JDBC is not as mature as Microsoft's ADO/OLEDB standards and not as many database drivers available to fully support the JDBC API and extended API. For example connection pooling was introduced in the JDBC 2.0 Standard Extension API, but we could find very few JDBC drivers that can support this extension. On top of that pure JDBC drivers (level 4) tend to be pricey and JDBC-ODBC bridges have poor performance.

Cross Platform
JSP/Java Servlets take number one in this category because there are many Servlet Engines provided by various manufacturers for any Web Server/Operating System you can think of. Cold Fusion comes as a close second because Cold Fusion is a one company show (all support for several Web servers IIS, Apache etc. and serval Oses - NT, 95,98,Unix, Linux - is because of Allaire's dedication), ColdFusion's cross platform support seems to be fairly good.
Upfront Costs
JSP/Servlets comes in first in upfront costs. To get started learning and using it all you need is Java Web Server which is free from Sun, an operating system of some sort, perhaps a JDBC driver. ASP is free if you have a Windows Operating System or have an ISP that supports it so is a close second. Cold Fusion Server starts around $500 to a couple thousand or is included in cost for web hosting.
Extended Costs
While JSP/Servlets has the lowest upfront costs, it is the most expensive to maintain for a serious web site for several reasons. First of all, since Java is much harder to learn than ASP or Cold Fusion, it is harder and more costly to find programmers proficient enough in Java Servlet/JSP to program dynamic content. Second JSP/Servlets is not as mature as ASP and Cold Fusion and has a faster change cycle - which means keeping up to date on what methods are deprecated or no longer supported which version of JSP API you have installed, which version of JDBC drivers and your Java run-time libraries. This is at times frustrating. Third for serious web development that connects to databases, you need to find JDBC drivers suited for your environment (Cold Fusion and IIS ASP have pretty robust DB support right out of the box).

Cold Fusion we ranked top in this category because while there are perhaps fewer CFML programmers than ASP, the language is so easy to pick up that it takes very little time for an inexperienced CFML developer with general web and database knowledge to do sophisticated and useful applications with it.

Links of Interest Information on Activer Server Pages, Java Server Pages/Servlets and other upcoming server pages technologies Makers of Cold Fusion. Also Livesoftware (Makers of JRUN Servlet engine) recently merged with Allaire. This site has a lot of information on Cold Fusion products, articles as well as JRUN Servlet material.
ASP 101 Samples and Tutorials for the ASP Programmer
ASP Today ASP Tools, News, Tutorials - some more advanced
Sun's Java Site Contains latest specs on Java APIs
Cold Fusion and SQL Server Article in April 2000 edition of SQL Server Magazine: An overview of using ColdFusion for Web development on the SQL Server platform A site maintained by Jason Hunter (writer of O'reilley's Servlet Programming guide) - contains samples of Servlet code and numerous articles on the Strength and weaknesses of Servlets and JSP as well as changes to these APIs.
asp SuperExpert Great site for articles on ASP/ASP+ and product listings for ASP.
Cool Servlets Great site for finding cheap and free Servlets.
Servlet Source Great site for articles on servlets and useful servlets and Java frameworks
ASP Free scripts and components for ASP

Back to Papers and Articles