ACTIVE SERVER PAGES
AND
JAVA SERVER PAGES
A Comparison
Submitted By : Arvind Venkataramanan
Piyush
Garge
Raja
Kothapalli
Introduction:
There has been a rapid growth in the use of Internet for the use commercial applications, which are playing a very significant role. There has been an increasing demand for the use of dynamic content rather than static content. Among the most popular known language for designing a web page has been HTML. HTML is purely a text base language that uses a series of tags to create a document that can be viewed by a browser. HTML is definitely not the right choice for programming. It allows very limited interactivity, it can provide interactivity to the extent that you can create a simple data form which has textboxes, checkboxes, pushbuttons etc. However to do any kind of data manipulation, the data from an HTML form is sent in a pre defined form in text to an executable file on server which handles the request.
CGI (Common Gateway Interface) receives input in the form of command line parameter from HTML and they use standard input and out put file handles of a program to receive and generate HTML output in response to a browsers request. The logic and the processing capabilities are built using CGI scripts. One of the main drawbacks of CGI scripts is that they create an entire process for each user that requests the application, which would mean creating a new process, running the script and killing the process created. This has a very severe impact on the performance of the web server. To overcome this a need for new technology was felt and as a result Active Server Pages (ASP) and Java Server pages (JSP) came into picture.
ASP and JSP allows you to create platform independent content that can be used in any browser. As ASP and JSP is scripting done on the server, this scripting code is evaluated dynamically when the page is requested, and the resulting HTML is passed to the calling browser. ASP and JSP run as a service on the web server and can take advantage of multithread architecture, which support multiple threads and hence multiple users. They are faster and easier to implement. They allow you to “separate programming logic from the page design through the use of components that are called from the page itself. And provide an alternative to creating CGI scripts that make page development and deployment easier and faster. While Java Server pages technology and Microsoft Active Server pages are similar in many ways, there are also a number of differences that exist. And these differences are just as significant as the similarities, and have far-reaching implications for the developers who use them as well as the organizations that adopt them as part of their overall web-based architecture.” Ref#1.
IIS (Internet Information
Server):
It is the primary web-server for sites constructed on Microsoft Windows NT technology. The functioning is quite similar to web servers that uses the common gateway interface to execute content. It supports applications that use the Internet server application programming interface or ISAPI. These applications can run much faster than CGI applications. ASP is an example of an ISAPI application. The complete version of IIS ships with Windows NT server 4.0 and can be installed during the Windows NT setup process. To make Windows NT server act as a web server, IIS administrator should be installed while setting up the server. Earlier versions of IIS would require ASP technology to be installed separately.
ODBC (Open Database
connectivity):
This is used for accessing data from a database. Web applications rely heavily on accessing data, ODBC simplifies development by allowing web pages to utilize structured query language syntax (SQL) to interact with the database.
Ref#16
Active
Server Pages:
What are Active Server pages?
Active server pages are HTML pages with scripts embedded in them for displaying dynamic Web Contents. The scripts could be Visual Basic scripts. It is Microsoft’s solution for dynamic web page creation and relies heavily on Microsoft technologies. It enables us to run Active X scripts and Active X server components. It is married to Microsoft and cannot run in any other environment.
ASP File:
An ASP file is similar to a HTML file and has an extension “.asp”. It contains HTML tags embedded with VB Script. Active server pages are scripting done on server side. When a page is requested by a browser it is treated differently, when it finds the extension “.asp”, the scripts are executed on the server and are returned back to the calling browser in a HTML format.
<TITLE>
ASP Example </TITLE>
</HEAD>
<BODY
BGCOLOR=”WHITE”>
<%For
x = 1 to 6 %>
<FONT
FACE = “ARIAL” SIZE = <% = x %>>
IWS
IS COOL !
</FONT>
<P>
<%NEXT
%>
</BODY>
</HTML>
The sample code includes a <SCRIPT> tag, but percentage signs appear inside the bracket. This syntax executes the code on the server before the page is downloaded to the client. All the code surrounded by percentage sign is evaluated before the browser receives the page. The resulting HTML code looks like this:
<TITLE>
ASP Example </TITLE>
</HEAD>
<BODY
BGCOLOR=”WHITE”>
<FONT FACE = “ARIAL” SIZE = <% = x %>>
IWS
IS COOL !
</FONT>
<P>
<FONT
FACE = “ARIAL” SIZE = <% = x %>>
IWS
IS COOL !
</FONT>
<P>
<FONT
FACE = “ARIAL” SIZE = <% = x %>>
IWS
IS COOL !
</FONT>
<P>
<FONT
FACE = “ARIAL” SIZE = <% = x %>>
IWS
IS COOL !
</FONT>
<P>
<FONT
FACE = “ARIAL” SIZE = <% = x %>>
IWS
IS COOL !
</FONT>
<P>
<FONT
FACE = “ARIAL” SIZE = <% = x %>>
IWS
IS COOL !
</FONT>
<P>
</BODY>
</HTML>
Ref#16
Syntax:
All the scripting is enclosed between the tags <% and %>. The default scripting language is VB Script, unless explicitly specified.
Thus from the example, output
returned by ASP is purely HTML which is understood by any browser, thereby
making it compatible to work with any browser.
This also adds to the security concerns since the code of the script cannot be seen by anyone, when one clicks “View Source” on the browser. This is due to the fact that the scripts are executed on the server and it returns the result of the execution, which is an HTML format. This is an advantage over client side scripting languages like JavaScript where the source code can be viewed. One could also freely add client scripts like Active X controls and Dynamic HTML to the output of ASP, thus making ASP pages more flexible as one wants it to be.
What
can be achieved through Active Server Pages?
·
Active Server pages can be
used to dynamically change, add or edit any content of a web page depending on
the user request.
·
Respond to data queries or
data submitted by users through an HTML form.
·
Through ODBC can fetch data
from database sources and return the results to the browser.
·
Can change the look and feel
of a web page to make it user friendly.
·
Minimize network traffic.
Example:
1. Display banner advertisements.
2. Display a catalog of products based on user request.
Active Server Pages Objects:
ASP has a number of built in objects, which help manage everything from variables to form submission. ASP objects are simple to use and can be called anywhere from the code without any special modifications or syntax.
Various
ASP objects are:
1. Application Object
2. Session Objects
3. Request Objects
4. Response Objects
5. Server Objects
Application
Object:
These objects are used to create application variables,
i.e. variable available to all users of an application.
Eg: Users requesting web pages from
the same virtual directory share any application variables defined in those
pages.
Code
sample:
<TITLE>
Application Variable </TITLE>
</HEAD>
<BODY BGCOLOR=”WHITE”>
This page
was last visited on <%=Application (“Time”)%>
<%Apllication.Lock%>
<%Application(“Time”)=Now%>
<%Application.Unlock%>
</BODY>
</HTML>
In this code
application variable is used to track the last time the page was visited.
Creating an Application variable is simple, you just have
to address the Application object with the name of the newer variable you want
to create.
Application(“Company”) = “NewTech”
The following code produces an application variable named
Company and sets its values to NewTech.
There is
an issue of concurrency i.e. you cannot guarantee that two users will not try
to set the variable to different value at the same time, associated with
application variables as number of users are using them simultaneously. To deal
with this situation Application Objects support Lock and Unlock methods.
LOCK: This method locks the entire application object, not
just the variable you are
changing.
UNLOCK: This method unlocks the object so always unlock the
Application Object immediately after changing variable.
Application Variables are used to store data temporary,
they can’t be use to store data permanently as an application variable is
destroyed as soon as Application_OnEnd event fires.
Session
Objects:
Variables for individual use are managed through Session
objects, which help us to create Session variables for individual use. Session
variables are simple to define you have to just address the Session object with
the name of the variable you want to define.
Main
difference between session variable and Application variable is the scope.
Session variables are reserved for just one user and last as long as the user
continues the session, if user stops requesting data from a virtual directory
the data is gone.
<Script
LANGUAGE=VBSCRIPT RUNAT=Server>
Sub Session_OnStart
Session
(“Company”)=”NewTech”
Session (“EMAIL”)=pgarge@cs.uml.edu
End Sub
</Script>
Session
variables can be accessed from any Web page in the application where the
variables were originally defined and can be created in any Web page or
GLOBAL.ASA file.
If
Internet applications are stateless as normally stated then how does ASP
remember session variables for each user of an application?
The answer
is that the session variables are saved on the server for each client. The
browser receives a unique identifier that tells the server, which set of data,
belongs to that client. The client stores the identifier, called a globally
unique identifier(GUID), and uses it later to retrieve the data stored by the
server. Thus, each client can have individual data for each application used on
the Internet.
Request
Object:
This
object comes in picture when client/server model comes into picture, whereas on
net this is normally the case. When a web server wants to send data to client,
it does so by creating a web page and sending it. When a client wants to return
data to web server, the browser relies on the process of form submission.
The
submission of form is controlled by two attributes of the <FORM> tag:
METHOD and ACTION. The METHOD attribute has two possible value: Get and POST.
POST tells the browser to package all data inside the form and send it to the
server. GET, on the other hand, send data as an integral part of the Uniform
Resource locator for the target page.
The
Request Object is used by ASP to parse submitted data received from a client.
To use the request object, simply provide the name of the field you would like
to examine, and the request object returns the value.
Eg. <% Request.Form(“txtName”)%>
Request.Form is
used anytime you want to examine the contents of a form submitted to an ASP
page. The Request object is only valid to ASP pages and can return data only
from a form submitted directly to your page and not from forms that were
submitted to your page.
Response
Object:
Response objects are used to mange the content returned to
browser by ASP. Syntax is similar to the other objects. It can be written in
shorthand as
<%=”NewTech”%>
This is
equivalent to
<%Response.Write “NewTech”%>
Another useful feature of the response object is the
Expires property. Response.Expires specifies the time in minutes before the
current page expires. It this property is set to zero, the web page expires the
moment it is downloaded and Internet explorer will not cache the page.
Eg.
<H1> The time is now <%Response.Write Now %>
Under normal
situations when a browser requests this page and sever script is run, causing
the current time to appear on the page. If the browser moves to another page
and then back to the page with the date/time stamp, the time will not change.
This is because browser has cached the results of the ASP page in RAM and does
not request a new page when the browser returns. Generally the first page is
flushed from the RAM cache when user has visited five different pages.
Server
Object:
Server
Objects provide a link between all objects by providing functions that are
related to each other in any way. Most important of all server is the
CreateObject method, which creates an instance of an Active X component. In any
case, using a server-side Active X component requires the CreateObject method.
The
following code shows how you could use
the CreateObject method to generate an instance of an e-mail component that has
ProgID of Mail..
Set
MyObject =
Server.CreateObject(“Mail.Connector”)
Ref#16
The key drawback of ASP is that it is available only on Micrsoft platforms and
requires Microsoft internet information server and hence is not platform independent.
It uses Vbscript and Jscript for scripting which are not very powerful and is susceptible
to crash under Windows NT.
There are many good features in ASP.
1) In ASP, the code and the logic are hidden on the web browser.
2) We can write smart code using VB script or Microsoft Java script.
3) One of the most interesting features of Microsoft Internet Information Server is that it has ASP built in it.
4) ASP is fast because it has the operating system and web server integrated in it.
Java Server Pages:
System Requirements
·
A servlet engine is required.
·
Java SDK (Software Development Kit) is to be installed
before installing the servlet engine.
is the reason why SDK must be
installed.
Servlet Engine:
Servlets are Java programs that are executed on the server and Servlet engine is necessary to enhance the power of servlets. Servlet Engine is a HTTP server. Engine uses servlets to perform operations like basic file service and server administration. Several standard servlets are started when the server initializes:
The FileServlet serves static document;
The InvokerServlet launches servlets requested by the client via a URL;
The SSInclude servlet handles servlets embedded in HTML files as server-side includes; The CgiServlet launches CGI programs;
The Admin servlet lets the Webmaster administer the server;
The ImagemapServlet processes image map selections.
All of these servlets run until the server dies.
What is JSP?
JSP stands for “JAVA SERVER PAGES” and is a technology invented by Sun Microsystems for creation of dynamic web pages. It is a server side scripting. JSP pages are similar to Microsoft’s Active Server Pages. They allow us to create customized web pages on-the-fly through Tag extensions. “JSP technology adheres to the “ Write once run anywhere” philosophy of the Java architecture.” Ref# 1. It is platform independent and can run on any web server.
It separates presentation and program logic. This makes the maintenance of java server pages easier because the presentation can be changed without making any modifications to the program logic. They use XML like tags and scriptlets written in Java programming language. The logic resides on the server and it executes these through tags and scriptlets. After executing on the server the result is then passed back to the response page. The default scripting language used is Java however other scripting languages like Java script and VBscript can be used. When Java is used as a scripting language for JSP it is more robust and flexible. They take full advantage of object-oriented feature of Java.
“JSP provides a number of server side tags that allow developers to perform most dynamic content operations without ever writing a single line of Java code. So developers who are only familiar with scripting or even those who are simply HTML designers can use JSP tags for generating simple output without having to learn Java. Advanced scripters or Java developers can also use the Tags or they can use the full Java language if they want to perform advanced operations in JSP pages.” Ref # 2.
How Does JSP Work?
When a JSP page is requested it initiates the JSP engine and checks for the existence for a compiled page into a servlet. It is the JSP engine that interprets and compiles the code embedded in a JSP page into a servlet. The engine however does not do the compilation every time a page is requested. It is only compiled the first time when it is requested or when any changes or modifications have been made. The servlet is then executed. This makes the execution of JSP page faster however the transformation phase is one of the areas where it could be slow.
JSP Request Model:

Ref# 2.
To
Understand the JSP request model it is important to understand the concept of
Beans and their use. “Beans shown in the model could be Java bean or enterprise
Java bean.” Ref# 2.
Java
Beans and enterprise Java Beans are similar to COM (Component Object Model)
components used by Active Server pages. They separate the business logic and
other codes. The functionality is encapsulated in the Component and is reused
across applications. They perform well-defined tasks and encapsulate object
data. Java beans are limited to Java programming language. “The Java component
has various attributes which can be set and methods that can be invoked on the
bean.” Ref# 3.
“Action Tags are used to declare the
use of a Bean within a JSP page. These tags take the following arguments:
1.
The JavaBeans Class.
2.
The name of the Bean
instance.
3.
The scope of the Bean.
The
scope of the Bean specifies the life cycle of the Bean and can take any of the
four possible values described below:
· Page: When the scope is set to page it means that it is only accessible
by a single client from the page on which it is created.
·
Request: Object is accessible by a single client
for the lifetime of a
single client request.
·
Session: Object is accessible by a single client
from anywhere in the
application for the lifetime of an entire user session.
·
Application: Object
accessible is by any client from any page within the
application for the lifetime of the application.”
Ref#2.
Beans
could be generated thorough servlets, which will contain the results of the
servlet operation, and the result could be displayed through the use of JSP
tags.
JSP Syntax:
There are five types of JSP
directives and scripting elements:
·
Directives
·
Declarations
·
Expressions
·
Code Fragment/Scriptlet
·
Comments
Directives:
These directives are for JSP engines and they tell the engine, what to do with the rest of the page without producing any visible output. Directives are enclosed within the tag <%@……..%>. The primary directives are page and include.
The page directive is normally used to specify the support needed by a particular code. It is declared on the top of almost all programs.
Eg. To tell a code to use a particular class we specify it as:
<%@page import=”java.util.Date”%>
Where to send the surfer in the event of a runtime Java problem:
<%@ page errorpage=”errorPage.jsp”%>
The include tag is used to separate
contents into more manageable elements, such as those including a common page
header or footer. The page include could be a fixed HTML page or JSP code.
<%@ include
file=”filename.jsp”%>
Declaration:
JSP declaration helps us to define page-level variables to store information or define supporting methods needed by the rest of the JSP page.
Declarations are found within the
<%!……..%> tag.
Eg: <%! int i = 0;
%>
Variable
declarations are terminated with a semicolon.
Expressions:
Expressions
in JSP are converted into a string and directly included within the output
page. Values can be dynamically calculated and inserted into the JSP page. JSP
expressions are surrounded by <%=…………….%> tag and it does not include
semicolons, unless part of a quoted string:
<%=i
%>
<%=
“Hello”%>
Code Fragments/Scriptlets:
JSP code is surrounded by
<%………..%> tags. This code is run when the request is serviced by the Web
Server. “Scriptlets are used to embed Java code into the page and the code is
inserted directly into the generated servlet when the page is requested.” Ref #
3
Eg:
<%for (int I=1; I<=4; i++) {
%>
<H<%=i%>>Hello JSP
World</H<%=i%>>
<%}%>
The above code displays the string
“Hello” within H1, H2, H3 and H4 tags
Following is the output of the above code………
Hello JSP World!
Hello JSP World!
Hello JSP World!
Hello JSP World!
Comments:
Normally you can include comments
in any language and it is a good practice. In HTML user can view these comments
if they do view source. If you don’t want users to see these comments you can
uses <%-- ……………--%> tag
<%-- Comment for server side only --%>
Ref #2,3,4.
Implicit Objects
Implicit objects are some of the syntax-related elements in JSP. Interaction with the executing servlet environment for the JSP page can be done by accessing these implicit objects in JSP scriplets. There should be minimized access to the implicit objects. An understanding of the latest Java Servlet API is required to fully utilize the implicit object set.
The following are set of available implicit objects.
1) request- This is a request from a client which includes parameters from
GET/POST requests.
2) response- This is a response from the page to the client.
3) pageContext- The page attributes are managed here.
4) session- This is a session which is associated with the request.
5) application- This object is a context in which the servlet is running.
6) out- This object is used for output stream which is used to send the response.
7) config- This object configures the servlet.
8) page- This object is the page itself.
9) exception- This object is for the error pages.
1) These objects can be used to access the servlet executing the JSP code within the
scriplets.
2) An implicit out object can be accessed directly to print something to the response
instead of using an expression.
e.g. <% out.println(“Hello”); %>.
3) A request object can get the parameter value, instead of directly sending a
parameter to a JavaBean.
e.g. <% String name=request.getParameter(“name”); out.println(name); %>.
Ref#10
How is JSP different from a Servlet:
Servlets are programs that run on a web server and they are used for creating dynamic web pages on-the-fly. It is a Java technology. They are similar to Java server pages because a JSP page is finally compiled into a servlet. The difference lies in the manner in which the HTML document is parsed. JSP handles the separation of program logic from page content in a much efficient way, thereby displaying the generated HTML document faster.
Drawbacks
of JSP:
One would imagine that JSP is the correct choice for developing web pages but it is the matter of language selection which could be attributed to its drawbacks, not from the functionality point of view but because of the language complexity, since it requires Java. For doing simple tasks JSP would require
java code to be embedded in the page. The manner in which
looping is handled is not efficient and is difficult to implement loops in JSP.
Advances are going on in JSP and there would be custom tags for implementing
these loops in near future. JSP page is transformed into a servlet and then
compiled, which results in odd and useless error messages due to page syntax
errors. Web server need a specific compiler to execute Java code, this creates
problem because Sun doesn’t give away the tools.jar library containing their
javac compiler. Web servers can package an outside vendor’s compiler such as
IBM’s jikes; but these compilers don’t work on all platforms and are of no use
to pure-Java web server. Java consumes lot of hard disk space and memory. For
every JSP file there is a corresponding larger class file. This doubles the
hard drive requirement to store JSP pages. In JSP you can simply include a
large data file by just using a simple tag i.e <%@include
>, this becomes a real concern when it comes to memory management and disk
space. To execute a JSP program, each JSP’s class file data has to be stored in
server’s memory which eventually stores the entire JSP document tree in the
memory.
To control the memory and the hard disk space from being
wasted, a template engine was introduced. With template engine there is no need
to duplicate a file into a second file and they give the programmer full
control over how template are cached in memory. There are various drawbacks of
using templates, they are:
·
There are no rules or
specifications stating the behavior of the template
engine.
·
Template engines are not
widely known and hence this technique is relatively
unknown.
·
Template engines are not that
efficient as JSP.
There are also some very good features in JSP.
1) JSP has the ability to access reusable components such as java beans from within
a JSP file.
2) It is platform independent.
3) The code (logic and programming) is separated from layout using java beans.
4) JSP uses a powerfully interpreted language called Java.
5) Servlets take full advantage of server-side java applications.
6) In JSP, custom tags available.
Comparison between ASP & JSP:
Both ASP and JSP have lot of similarities and they both were designed keeping a single aim in mind and that was, creating dynamic web pages. They both were developed because CGI couldn’t be used for server side scripting and due to the recent developments in technology the need to develop server side scripting was felt. Hence ASP and JSP came into picture. JSP came into existence after ASP and hence inherits a lot of features from ASP.
Both separate programming logic from presentation design i.e. the business rules can be separated from the manner in which the resultant output will look like. This plays a significant role as it makes the maintenance simpler and increases code reusability.
Platform Dependence:
ASP is a technology developed by Microsoft and it can be only used with Microsoft technologies hence ASP is platform dependent, it can be only run on Microsoft IIS or Personal Web Server. ASP uses ActiveX objects that are platform specific. However ASP could be used on other platforms but would require third party tools from other vendors.
JSP on the other hand is designed to be both platform independent and server independent hence it can be run on any Web server including Apache, Netscape and IIS. This is one of the most significant differences where it scores over ASP. Today the technology is changing in a such a rapid manner and organizations change their business needs, hardware and software requirements, that it becomes very useful to have technologies that are portable. JSP can also be used with a wide variety of tools from different vendors.
Page Access
Active server pages have to be translated each and every time they are requested this slows down the response as it would require to compile the pages for every access of the page irrespective of whether any changes are made or not.
Java Server pages are compiled only the first time they are requested. When the pages are requested it is first checked to see whether any changes are made and if so they are compiled. Thus for subsequent page request the access is faster.
Reusable cross platform components:
ASP supports Component Object Model (COM), which is not reusable across platforms. COM objects as mentioned earlier are used to separate business logic and other codes. They can be written in any language and need to be registered on the server before one can use it. The server is required to be rebooted every time any changes are made to reflect the changes for subsequent access.
“JSP uses components like Java Beans, Enterprise Java Beans, Custom JSP tags which are reusable across platforms. An Enterprise Java Bean component accessing legacy databases can serve distributed systems on both UNIX and Microsoft Windows platforms and the tag extension capability of JSP technology gives developers an easy, XML like interface for sharing packaged functionality with page designers throughout the enterprise.
This component-based model speeds application development because it enables developers to:
1. Buil quick prototype applications using lightweight subcomponents,then integrate additional functionality as it becomes available.
2. Leverage work done elsewhere in the organization and encapsulate it in a Java Bean Or Enterprise JavaBean component.”Ref#1
Java Beans perform well-defined tasks and functionality is encapsulated in the component and reused across applications. They are limited to Java programming and are not required to be registered on the server.
Language Selection:
ASP pages are created using Microsoft Vbscript or Jscript. These languages are not as powerful as Java and are susceptible to crash under Windows NT. They also do not have any memory leak protection.
“A memory leak is the gradual loss of available computer memory when a program (an application or part of the operating system) repeatedly fails to return memory that it has obtained for temporary use. As a result, the available memory for that application or that part of the operating system becomes exhausted and the program can no longer function. For a program that is frequently opened or called or that runs continuously, even a
very small memory leak can eventually cause the program or the system to terminate. A memory leak is the result of a program bug.”
Ref www.whatis.com
JSP uses Java language for scripting. This is one of the most significant advantages of JSP because it uses all the capabilities of Java as a programming language. One of the key features of Java is its object-oriented approach. Objects are always allocated dynamically and manipulated through references thereby simplifying the semantics and storage management is handled automatically. It also plays a significant role in the field of networking because it includes classes for working with URL’s and sockets. It is also a very Robust language as compared to Vbscript and Java script. It has strict type checking and has excellent exception handling capabilities and performs a number of checks at run time. The most significant feature of Java is its capability for handling memory leaks. It supports garbage collection, a mechanism by which the operating system automatically removes all the dangling pointers and unknown references which use memory thereby freeing up the unwanted memory space. It can also sustain crashes.
Tags:
ASP uses a combination of tags but do not support custom created tags.
JSP uses XML like tags and supports the creation of custom tags. Thus one can have custom tag libraries, which gives more functionality and increases the sharing capabilities.
Object Comparison:
ASP keeps track of user state information through session objects and application values through Application object while JSP uses HttpSession objects for user state information and Servlet Context Object for Application values.
Database Connectivity:
“ASP is compatible with legacy databases through COM while JSP needs JDBC API. ASP works with any ODBC compliant database to integrate with data sources while JSP works with any ODBC and JDBC technology compliant database” Ref#1.
The maintenance of Java Server pages is easier than maintaining Active server pages because
1) Java based applications are easier to maintain.
2) Java language is a structured and modular language.
3) It is easier to make changes in JSP.
5) JSP separates application from other design issues such as database access, security etc.
6) JSP applications are not affected with upgrades to servers, platforms.
Ref#1
Platform dependence is the key factor in deciding whether ASP or JSP is better. When we study the statistics of the usage of different Operating systems, we notice the following:
22% of the webservers are on Windows NT
21% of the webservers are on Linux
57% of the webservers are using others.
The above statistics show that 78% of the webservers are not on Windows NT.
Since JSP is platform independent, it would be a better choice than ASP. Due to this JSP can address a larger audience.
Ref: Red Hat site (Can’t remember the exact link)
Lutris’ Enhydra: An alternative to JSP and ASP.
A new Java/XML application server technology which separated the role of designer and the role of the developer in creating Web pages was developed by a consultancy called Lutris Technologies Inc. This allowed the designer and developer to concentrate on their own areas of expertise.
The latest version of Lutis’ open-source Web server called Enhydra 2.1 is an alternative to JSP and ASP. To build a web page, Java code embedded in HTML is used in JSP whereas Visual Basic script is used in ASP. These technologies often required designers to act as developers and sometimes developers had to act as designers. To solve this problem, a unique compiler called Enhydra XMLC was developed by Lutris.
Using this technology, the developers and designers can function independently.
Initially, the designers and developers have to reach an agreement about the placement of ID tags in a HTML document. These tags show the areas of the page that would change based on Java business logic. These tags would help the designers to build the page only using HTML and the engineers to write the code only. These tags also help customers build HTML templates using any tool, which without affecting the underlying application can be changed and reused. The ID tags not being able to be changed are the only restriction.
The HTML file is run through the Lutris compiler after it is completed. This compiler changes the file to XML and then to a java class. This Java class is invoked by the business logic. This is packed in a JAR file and then it can be run on Enhydra or any other Java application server.
Ref#5
The Web used to be mainly used for distribution of static documents. Text and Images used be only posted on the Internet. Common Gateway Interface(CGI) has transformed the web to an interactive platform on which businesses can have functional applications from what used to be a simple file retrieval system. Recently, development has been moving toward server side scripts. The main reason behind this was scalability. In CGI, when a user launches a new process on the server, it slows down the application. When scripting is done on the server, it allows the developers to do whatever changes are needed at a distance and they can also see the effects on the application without having to recompile.
Due to the drawbacks of CGI scripting, ASP and JSP technologies came into existence and they have a lot more to offer to the industry in their search for a technology to create dynamic web pages and it has helped many to implement e-commerce solutions.
The choice of using one of the two technologies is dependent on ones needs and the cost of project where it shall be implemented. Also Language selection makes an important criteria for the same as ASP usesVBscript and JSP uses extensively java.
As we have seen and done a coparitive study of both the technologies, it is very clear that JSP has more to offer than ASP. One of the main areas where JSP scores over ASP is platform selection. ASP can work only with Microsoft technologies and thus one is restricted to the choice of platform. JSP on the other hand is platform independent which is great advantage. It gives the flexibility to the industry or anyone implementing JSP solutions to switch platforms on a later date and not worry about their JSP solutions as they do not have to re-write the code. This saves money and time.
For those who are searching for a better method to produce web content and for those searching for a method to make their dynamic websites more portable with different server architectures, JSP gives a powerful solution. For those who are developing in multitier environments, JSP has back-end data sources like JDBC and EJB which have a mechanism to easily change the application’s visual appearance without changing the business logic.
JSP saves time for development and deployment. It gives on-the-fly customization by tag extentions. This enables addition and distribution of new web page functionalities across the different platforms.
The world is moving towards solutions that have the capability of “Write once, Run anywhere”. JSP is becoming an important technology to make dynamic web pages. Latest JSP technology is to include tag extensions that allow third-party creation of functions like database connectivity and tool support.
JSP is sure to get a great deal of attention from web developers, for its support to not only normal programmers by using simple tags, but also to advanced scripters and Java developers. As JSP is a open standard which allows other languages like javascript, to be used instead of java, it can get a much broader support in the industry.
References:
1) Java server pages
http://java.sun.com/products/jsp/jsp-asp.htm
2) Introduction to java server pages
http://developer.netscape.com/viewsource/kuslich_jsp/kuslich_jsp.html
3) A look inside Javaserver pages
http://www.webtechniques.com/archives/1999/11/note/
4) Java Syntax
http://www.builder.com/Programming/JSP/ss02.html
5) Alternative to JSP and ASP: Lutris’ Enhydra
http://www.zdnet.co.za/pcweek/0514/calter.html
6) Java for ASP developer
http://www.asptoday.com/articles/19991022.htm
7) JSP FAQ
http://www.esperanto.org.nz/jsp/jspfaq.htm
8) Problems with JSP
http://www.servlets.com/soapbox/problems-jsp.htm
9) JSP Tutorial
http://slinky.surfnetusa.com/jsp-heaven/tut/intro.htm
10) JSP Implicit Objects
http://builder.com/Programming/JSP/ss04.html
11) ASP pages
http://www.acecomputer.com
12) Dynamic generation for the web
http://java.sun.com/features/1999/06/jsp.html
13) ASP components
14) http://asp.superexpert.com/tutorials/asp.html
15) Examples- http://www.activeserverpages.com
16) Programming Active Server Pages Microsoft Press