IndiaWebDevelopers.comA global technology company specializing in web applications and enterprise solutionsContact UsAbout UsFAQHome
India Web Developers - A global technology company specializing in web applications and enterprise solutions  
YOU ARE HERE: TECHNOLOGY >JSP VS ASP
 
Technology
Design Tools
Open Source
Java-Centric Technologies
Oracle 9i
Microsoft-Centric Technologies
ASP.NET
Cutting-Edge Technologies
Search Engine Technologies
XML
ZOPE
Related Links
Other Links
SEARCH
 

JSP vs ASP

By Karan Dass

   

JSP vs ASP

Introduction

5-6 years back it was easy to choose a server-side language as CGI used to be only the only scripting language available. But in due course of time, the developers found out that CGI scripts were inefficient and it was very difficult to write server extensions.

At that time, Microsoft came up with Active Server Pages (ASP), which allows developers to use simple scripting to access the server and its extensions. But ASP had some disadvantages. It limits you to work on Microsoft platforms, and the simplest of mistakes in the script can cause the server to crash or hang, effectively bringing down your website.

In response to ASP, Sun Microsystems gave the world Java Server Pages (JSP) technology, which is entirely based on Java programming language. Internally, JSP pages are dynamically converted into Servlets, which are simply Java classes. This means JSP enjoys all the capabilities that Java programming supports.

JSP is a great deal more efficient than many other scripting languages, such as CGI and ASP. Tags can be defined in tag libraries and then used within any JSP page. This makes for a better separation of page content from its code, which leads to less scattered code and hence, the site is easier to maintain. Global changes need to be made only to the tags defined in these tag libraries, making time-consuming, page-by-page fixes things of the past.

JSP versus ASP

JSP and ASP have some basic concepts in common.

1) They both make use of simple sever-side scripting to provide access to Web server information and functionality.

2) They both have similar styles of delimiting this scripting from a page's content. In fact, Microsoft's has recently come up with ASP+ is much more similar to JSP than ASP.

Yet while ASP primarily supports two scripting languages, JScript and VBScript, JSP actually supports real Java code, not a new scripting language. The difference is that the Java code inside a JSP page is more script-like because it doesn't require Java class and package definitions. JScript, VBScript, and Java
(in JSP) are all object oriented to some degree as they are all
provided with a set of pre-established objects by the Web server
that they use to generate a dynamic Web page.

The following table lists some of the instantiated objects that are available in both ASP and JSP.

JSP ASP Definition
Request Request Access to request information.
Response Response Access to response information.
Session Session Access to session information.
Application Application Access to application information.
Out Response.Write Access to the response output stream

Note that JSP is case sensitive. But VBScript is not.

As I mentioned earlier, both ASP and JSP support a similar way of delimiting scripting from content on a page. <% and %> are used to set of sections of script, '<%=' and '%>' are used to return a value within content, and <%@ and %> are used to delimit page directives.

JSP supports two basic styles of delimiting its scripting elements from page content. The first looks a great deal like ASP, whereas the second can be used to create JSP that is fully XML compliant. Here, let's examine these styles:

Base Style XML Style Description
<%@ directive %> <jsp:directive.directive/> Directives are used to specify page information, include other files, and specify tag libraries being used.
<%! declarative code %> <jsp:declaration>
declarative code
</jsp:declaration>
You can declare new methods using these tags.
<% code fragment %> <jsp:scriptlet>
code fragment
</jsp:scriptlet>
This code is placed within a base method of the generated servlet.
<%= code expression %> <jsp:expression>
code expression
</jsp:expression>
This code is appended to the output stream being returned for the page.

Conclusion

In many ways, the biggest difference between JSP and ASP technologies lies in the approach to the software design itself. JSP technology is designed to be both platform and server independent, created with input from a broader community of tool, server, and database vendors. In contrast, ASP is a Microsoft technology that relies primarily on Microsoft technologies.

Now as we have seen the advantages of JSP over ASP, I'll like to share some information on JSP with you:

" There are a number of servers that support JSP on the market. The popular ones are Tomcat, Jrun and Enhydra.

" Another powerful feature of JSP that we haven't covered in this article is its ability to utilize JavaBeans with special tags defined in JSP. For more information about this, you can refer to Sun's JavaBean overview.

If you want to learn JSP, the best place to start is at the Sun Microsystems web site (http://java.sun.com). Their support pages include the JSP specification and documentation of the supporting Java classes. As you explore, make sure you get a good idea about the underlying Java Servlet technology, since this is what all JSP must become behind the scenes.

As you open up JSP and really see what it can do, you'll soon find that, with practice, anyone (not just Java developers) can make use of the powerful set of tools that JSP provides.

Useful Links
1) Java Server Pages TM Fundamentals
2) ASP Tutorial
3) How JSP compares with ASP

Related Links - Java Centric

 
 
 
 
Contact us with your project needs for a Quick Reply!
 
     
 


Web Development India
The web division of Stylus Systems Pvt Ltd www.stylusinc.com ©1999-2008