|
| One Hour HTML -
Learn the language of the web in just 60 minutes. |
JSP: Java on Your Server
by Anthony Stai
JSP stands for Java Server Pages. The idea of JSP is to allow Java code
to be embedded in HTML – this is done uising XML tags. JSP allows
you to dynamically add content to your pages, and also offers the
facility to send Java to the web browser easily.
The Lack of Functions.
Most of the built-in JSP functions do nothing more than flow control:
it barely offers any built-in functions at all. Instead, you have to
define your own tags using tag libraries. This makes the language
extremely extensible, but not much use if you just want to get started
quickly and write a simple database-driven website.
The most significant reason to use JSP is that it gives you all the
power of Java when it comes to adding things to your HTML pages. In big
companies especially, these Java capabilities are very important. The
flexibility of the language is also very useful for larger projects: in
some ways, JSP is more like a 'build your own programming language kit'
than it is a language in itself.
Separating the Application Logic.
The real point of JSP is to separate out your application's logic (the
part that does things) from its presentation (the HTML). JSP is,
basically, a very minimal language intended to do little more than help
turn the output of a Java application into a web page. This has the
advantage of letting you write an entirely new website using your
existing application as the backend – but it has the disadvantage
that it can be difficult to add any new functions to the site unless
you know what you're doing in Java.
Unfortunately, the downside of doing things this way is that, if you're
not strict about it, HTML code will have a tendency to start creeping
into the output of the backend Java application. If that happens, it
will make it difficult to rewrite your JSPs without ending up with
broken web pages.
Is Java a Good Idea?
One of the advantages of JSP is that it can easily take Java applets
and throw them onto the web. When it comes down to it, though, Java
isn't usually a good idea. Why? Well, it takes a long time to load,
it's slow when it does load, and it doesn't tend to do anything that
couldn't have been done better in Flash or even in plain old HTML. On
the web, Java has come to be considered harmful.
On the server, though, Java is a fine idea, at least if you're good
enough to program in it. There are simpler languages out there, but
Java is cross-platform, standardised and does pretty much everything
you could want it to. You will, though, need a pretty powerful server
to use Java for any significant number of requests.
JSP or ASP?
JSP is obviously named to point out the fact that it is an alternative
to Microsoft's ASP. So why would you use one instead of the other.
Well, while ASP has the simplicity of Visual Basic on its side, JSP has
the power of Java, and, more importantly, its cross-platform
capabilities. While ASP will tie you down to a Microsoft platform, JSP
can be used on any operating system capable of running Java – and
that's just about all of them.
JSP or ColdFusion?
What JSP and ColdFusion have in common is that they can both interact
with Java – but which is better? For most projects, the answer is
ColdFusion: if you're building something relatively small (meaning
non-enterprise), ColdFusion's built-in functions should be sufficient
and the code shouldn't be able to grow so large as to be unmanageable.
Should JSP Stay in the Enterprise?
People with small website usually fall into one of two camps: the
vendor-devoted people who are quite happy to run their whole system on
Microsoft or Macromedia products because it saves them time, and the
open source devotees who use languages like PHP because it saves them
money and they support the principles involved. Among these two camps,
there isn't really much room for JSP, and in most cases, there
shouldn't be. Unless you're building a project that's larger than the
average, or you've already got a Java application you want to write a
web interface for, you'll probably be better off giving JSP a miss.
About
The Author:
Anthony Stai invites you to
take your
website to the next level. Get one of the best Search Engine
Optimization (SEO) books on the market for Free! Learn the techniques
that differentiate the amateurs from the pros. Get your book at http://www.makemoneyonline4you.com/seo.html
|
|
|
|