|
•10 Tips for Killer Website Design
•7 Sure shots ways to improve your website
•Attracting Visitors and Improving Your Search Results
•Chasing the Search Engines Algorithms
•Crash Course in Getting a 1 Google Ranking
•Design Basics
•Design Your Site for Traffic in 2005
•Designing A Website That Sells
•Googles Good Writing Content Filter
•How to Write Effective Web Copy
•How to Write Title Tags for Your Web Pages
•JSP Actions
•JSP Directives
•JSP Scripting Elements and Variables
•JSP
•Java Brewing A Tutorial
•Java How to Send Email in Java
•Java Intro to JSP
•Java JSP Browser Detection
•Java JSP Syntax
•Java JSP versus ASP
•Java MySQL Database Connection
•Java Programming Language
•Java Virtual Machine
•Java myths
•JavaBeans
•Linux Commands
•Make Money Fast With Google Adwords
•Make Money On The Internet What Is Your Niche
•Make Money Quick With Google Adsense
•PHP Redirects
•Ranked 1 at Google for Invisible Entrepreneurs But No Traffic
•Ruby Basic Input Output
•Ruby Classes Objects and Variables
•Ruby Containers Blocks and Iterators
•Ruby and the Web
•SEO One Way Web Links 5 Strategies
•SEO Success Step Two Attracting Search Engine Attention
•The 10 Best Resources for CSS
•The 3 Best Website Traffic Sources
•The 5 Biggest Mistakes Almost All Web Designers Make
•The Click Fraud Problem
•The Five Ways You Should Be Using Keywords
•The Three Principles Of Image Optimization
•Top 5 Secrets to Making Money with Adsense
•True Paid Inclusion Programs are a Thing of the Past
•Understanding Web Logs And Why it Matters
•Index
•Rename underscores.sh
|
Web Hosting Tips for Webmasters -
JSP versus ASP
JSP versus ASP
Intro to JSP
Page 2
JSP versus ASP
JSP and ASP do have some basic concepts in common. They both
make use of simple sever-side scripting to provide access to Web
server information and functionality. They both do so using object
oriented scripting. And they both started out with similar styles
of delimiting this scripting from a page's content. In fact,
Microsoft is replacing ASP with ASP+ (or the
.NET architecture), which
is even more like JSP than ASP in that its pages are compiled upon
request and run in a "virtual machine" (which supports multiple
languages and is written in C#).
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. As you will see, the Java code
inside JSP is added to methods of a Java Servlet that are generated
the first time the JSP is requested. Of course, JScript, VBScript,
and Java are all object oriented to some degree, or maybe to avoid
getting into a political argument with those of you would dispute
this claim I should refer to them as "Quasi-Object-Oriented."
Whatever we choose to call them, we can at least agree that the
scripting languages used by JSP and ASP 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 pre-established
(instantiated, for the purist) objects that are available in both
ASP and JSP.
| ASP | JSP | Definition |
| 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. |
Note that JSP is Java, so it is case sensitive. But
capitalization doesn't matter in VBScript, so if you stick to
lowercase, there really isn't any difference in the names.
These are the main objects we have to work with when creating
dynamic content in either ASP or JSP, so it's a good idea to become
familiar with their methods. I'll use some of them in the examples
that follow, but I can't go into every method available within the
limits of this article.
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. Here is a brief example using both ASP and
JSP:
| ASP (using JScript) |
<%@ LANGUAGE = JScript %>
<TITLE>Simple Scripting Tricks</TITLE>
Anyone can count like this:<BR>
<%
for (i = 1; i < 6; i++) {
Response.Write(i + "<BR>");
}
i = 1000000;
%>
It would take a long time, however, to count to <%= i %>.
|
| JSP |
<%@ 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 %>.
|
| HTML Output (from either JSP or ASP) |
<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.
|
As you can see, there are some basic similarities between ASP
and JSP. In fact, in this simple example, there's almost no
difference. When we look deeper into JSP, however, fundamental
differences will appear.
|
|