|
Java Server Pages, or JSP, were developed in response to
Microsoft's Active Server Page technology. In many ways the two
technologies are very much the same; however there are several
important differences.
As you might expect since both ASP and JSP attempt to
achieve the same goal they share many similarities one of these is in
the basic objects used.
From WebMonkey.com
|
ASP Objects
|
JSP Objects
|
Function
|
| Request |
request |
Access to request information. This includes such
items as input/form parameters, HTTP request header information, etc. |
| Response |
response |
Access to response information and construction.
This includes output MIME type and other HTTP response headers as well
as the output stream itself. |
| Session |
session |
Access to session information. |
| Application |
application |
Access to application information. |
| Response.Write |
out |
Access to the response output stream. JSP
provides a convenience object for direct output to this stream, whereas
ASP uses a Response object method. |
JSP unlike ASP is based on the full Java programming
language. As discussed on the ASP page, ASP relies on scripting
languages which are limited in capability and cannot be compiled like
the full featured programming languages.
JSP contain a mixture of HTML or XML markup and Java
code. The first time a JSP page is retrieved from a server it is
processed into a Java source file. The resulting source file is then
compiled into a Java servlet that will run much faster than interpreted
code such as VBScript. A developer may choose to write the servlet
directly if the majority of a JSP may be Java code over markup language
this provides even better performance.
JSP is based on the fully functional Java language; JSP
can take advantage of all of the Java platforms abilities and
technologies. Enterprise Java bean are often used with JSP to reduce
the amount of code contained in the JSP or Servlet. Enterprise Java
Beans or EJB, are reusable components that can be called in multiple
pages or programs and provide reusable functionality.
One important feature of JSP is the ability to create
Tag Libraries. Tag Libraries allow you to write code for your site that
is reusable. For example, if you write a function used on many pages,
crate a tag and add it to a tag library. You can just use the tag in
all pages that use the function. This allows for increased
maintainability as you can change the function in one place and have it
used everywhere that tag is placed.
From WebMonkey.com
|
Java Source Code
|
HTML Results
|
<%@ page language="java" %>
< TITLE>Simple Scripting Tricks</TITLE>
Anyone can count like this:<BR>
< %
for (int i = 1; i < 6; i++) {
out.println(i + "<BR>");
}
i = 1000000;
%>
It would take a long time, however, to count to <%= i %>.
|
<TITLE>Simple Scripting Tricks</TITLE>
Anyone can count like this:<BR>
1<BR>
2<BR>
3<BR>
4<BR>
5<BR>
It would take a long time, however, to count to 1000000.
|
Further, Because JSP is based on Java and the language
allows much higher levels of hardware and operating system platform
independence JSP can be run on many more operating systems and hardware
then a proprietary technology such as ASP and ASP.NET that are almost
totally restricted to the Microsoft Windows platform. JSP can be found
running on UNIX, Windows, Linux, and even Mainframes.
JSP can be run on many servers hear are a few
examples:
- Macromedia JRUN (Also the core server Cold Fusion is
build on)
- Tomcat
- Sun Java System Application Server
- IBM Web Sphere
JSP development tools
- Borland JBuilder
- Sun One Studio
- Many open source editors
Additional Information on Java Server Pages (JSP)
- Web Monkey JSP overview
- Web Developers Journal
- Sun Microsystems JSP
- Apache
Jakarta Project
|