An ASP file, as you know, is an HTML file embedded with server-side
script that is usually written in a form of Visual Basic called
VBScript. I say "usually" because there is an option for using server-
side JavaScript. The JavaScript option is rarely since VBScript is the
default server-side language for IIS servers and is much more widely
supported than JavaScript on IIS.
A JSP page is an HTML file embedded with server-side script that is
always written in Java. This is not a "scripting" version of Java, but
a full implementation of Java plus a few calls and tags specific to
managing HTTP protocols and HTML environments.
The hard separation between the two is that ASP is Microsoft's solution
and JSP is Sun's. JSP is not supported directly on IIS. ASP is not
directly supported anywhere that implements a non-Microsoft server
solution.
A few third party add-ons provide full JSP support in an IIS
environment. The leading third party products are JRun and ServletExec.
These products install themselves as ISAPI filters, intercepting
requests for JSP pages and passing them off to a Java Virtual Machine
(JVM) for processing.
Unfortunately, if you wish to run both ASP and JSP on the same IIS
server using one of these add-ons, JSP performance will suffer.
Microsoft's ASP processor takes priority over the background JVM. Also,
JSP and ASP run in different memory spaces, so the two environments
maintain their own session objects. Session cannot be shared between
the two.
If your server platform is already selected, the choice between JSP and
ASP is simple. For Microsoft server implementations, use ASP. For
others, use JSP.
The selection of an appropriate platform is well beyond the scope of
this newsletter, but let's assume that you've yet to make that decision
and the features of the development tools are a big part of that
decision. In this case, the choice between JSP and ASP becomes much
more complex.
By now, you are familiar with how ASP pages are processed. JSP pages
follow a very different path. When the server receives a JSP page
request, the timestamp of the page is compared against a cached,
compiled, version of the file. If the compiled version is out of date,
it is immediately recompiled. The Java servlet engine then loads the up-
to-date compiled version. (All JSP pages are compiled into Java
servlets).
Once the JSP's servlet is loaded, all subsequent calls use the cached,
compiled version. The optimal use of caching makes JSP response great
for large memory servers.
JSP pages have full access to Java classes, beans, and Enterprise Java
Beans (EJBs). ASP pages use ActiveX components, COM, and DCOM. Neither
support the other's interfaces. If you have a third-party vendor
providing ActiveX components as their interface, ASP is the best option.
Overall, new JSP development takes longer than ASP development and
requires a more expensive staff. On the other hand, long-term
maintenance of a well-designed JSP site should require less time and
resources.
JSP does have some design issues that separate it from ASP. For
example, in ASP I can embed HTML in a function so that I can call it
several times form the page. In JSP, this just doesn't work. You must
put your entire HTML inside an out.write() call. What this means, long-
term, is that you must engage a developer to make simple content
changes.
I have developed large, high-volume web sites in both JSP and ASP. I
have had great success using both. I also had a good time developing in
both platforms.
The ASP implementations were driven by the necessity of using IIS. The
design and development cycles were quick and required a mid-range
development staff. The JSP implementations contained fewer pages, took
longer to design and develop, and required a much more experienced
development team. In long-term maintenance costs, though, JSP seems to
win out. This may be related to the server platform (UNIX-based), more
than the development tools. As a side note, the cost of the hardware
platforms to fully support a high-volume site tends to be higher for
JSP implementations than for ASP.
In summary, ASP provides a less expensive, faster implementation than
JSP. A well-designed JSP application may provide longer-term cost
savings.