Comparing these two technologies is both a difficult and sensitive task
but it is important to appreciate the differences in the way that the
various interfaces, and the applications that connect to them, work.
JavaServer
Pages (JSP) and Microsoft Active Server Pages (ASP) technologies provide
a simplified, fast way to create web pages that display dynamically generated
content. While ASP and JSP technologies are similar in many ways, they
also differ significantly in some ways.
Both the technologies follow the same model of separating programming
logic from page design through the use of components that are called from
the page itself. And both provide developers an easier and faster alternative
to creating web applications using CGI scripts.
The biggest difference between JSP and ASP technologies lies in the approach
to the software design. ASP is based on ISAPI whereas JSP is implemented
as a part of J2EE.
ASP consists of a single DLL (asp.dll) which generates dynamic content
when an ASP page with server-side script combined with HTML is parsed
through it. Similarly, the JSP-enabled engine on the web server will process
the JSP page, which may include technology-specific tags, declarations,
and possibly Scriptlets in JAVA, along with HTML or XML tags.
Here I have attempted to describe the main strengths of JSP as compared
to ASP:
Portability
A Portable application environment gives organizations the flexibility
to migrate servers and swap tools, as business needs change. Portability
also enables developers to share their work with a wider audience.
Java Server Pages technology delivers "Write Once, Run Anywhere"
capability, offering unprecedented reuse on any platform and on any server.
JSP is being developed through an industry-wide initiative led by Sun
Microsystems and is designed to be both platform and server independent.
In contrast, ASP is purely a Microsoft based technology deployed primarily
on Windows NT servers. JSP technology was designed to support numerous
servers, browsers and tools. Apache webserver, which hosts more than 70/%
of the websites worldwide, will now fully support the JSP technology under
the Jakarta Tomcat project. So, having to hosting a web application on
a robust UNIX OS with JSP is not a distant dream. JSP is also being supported
on the NT platform using third party components.
Performance
Pages built using JSP technology are typically implemented using a translation
phase that is performed once, the first time the page is called. The page
is compiled into a Java Servlet class and remains in server memory, so
subsequent calls to the page have very fast response time whereas in ASP
the page is recompiled for every request.
JSP implementations support a Java programming language-based scripting
language, which provides inherent scalability and support for complex
operations.
Most JSP pages rely on reusable, cross-platform components (JavaBeans
or Enterprise JavaBeansTM components) to perform the more complex processing
required of the application, instead of relying heavily on scripting within
the page itself. Developers can share and exchange components that perform
common operations, or make them available to larger customer communities.
The component-based approach speeds overall development and lets organizations
leverage their existing expertise and development efforts for optimal
results.
The results of a performance test (ASP vs JSP) done by a JSP enthusiast
is available for your comments - http://www.geocities.com/gslender/.
Be sure the results would improve if MySQL and UNIX were used in the test
configuration.
Development & Deployment
Component-based Architecture
As mentioned earlier, JSP follows the model of separating programming
logic from page design through the use of components like JavaBeans, Enterprise
JavaBeans (EJB) and custom JSP tags. Assuming that web page developers
are not familiar with scripting languages, JSP technology encapsulates
much of the functionality required for dynamic content generation in easy-to-use
JavaBeans components. The page developer can instantiate JavaBeans components,
set or retrieve bean attributes and perform other functions that are otherwise
more difficult and time-consuming to code. Microsoft's answer to component
architecture relies on COM/DCOM to supplement the ASP technology. Given
the complexity involved in developing COM components in VC++ or VB, it
is by no means a comparison to the simplicity of JavaBeans, which can
be easily developed using Java.
Custom Tag Libraries
The JSP technology is extensible through the development of customized
tag libraries. This lets web page developers work with familiar tools
and constructs, such as tags, to perform sophisticated functions. ASP
does not directly support custom tags like JSP but supports XML.
MVC (Model-View-Controller) or Model 2 Architecture
Separation of Presentation and Business Logic has never been so easy
with ASP or JSP. With increasing complexity the pages would clutter with
Scriplets and processing code, making it hard to debug or make changes.
To counter this problem, the JSP/Servlet's Model 2 architecture was introduced,
providing a cleaner approach to code manageability. This is a hybrid approach
for serving dynamic content combining the use of Servlets and JSP. It
takes advantage of the strengths of both technologies: JSP is used to
generate the presentation layer and Servlets to perform process-intensive
tasks. The Servlet acts as the controller processing the requests, creating
beans (models) or objects used by the JSP, and depending on the user's
actions, dispatches the appropriate JSP page to the user. The JSP (view)
page, which contains no processing logic, is simply responsible for extracting
and inserting the dynamic content from the Servlet into static templates.
Conclusion
Being an EX- diehard fan of Microsoft, from experience I have discovered
the JSP/Servlets Technology to be more than just an answer to Microsoft's
ASP technology. JSP has become more robust and scalable with the release
of J2EE. With an ever-growing support for the Java technology the JSP
solution is gaining prominence and immense respect from the developer
community. Its time to break free from the tyranny of Microsoft and embrace
the technology from the Open Source world.