Java Server Pages is a language similar to Microsoft's
ASP for creating dynamic web pages. Sun has created a language specification.
With JSP, a single source textfile is created containing both HTML (or XML) tags
and Java-like scriptlets. The JSP-aware web server creates, compiles and runs a
servlet from the source text. For increased efficiency, the JSP-aware server
will typically cache the compiled servlets. The compiled form are perfectly
ordinary Servlets, and thus can be mixed in with ordinary Servlets.
Part of the magic of JSP is that you can replace JSP source code on the fly
while the server is active. The next time a request comes for that JSP code,
will be automatically recompiled.
To master JSP you need to master several languages:
Hello.jsp
Here is a the JSP equivalent of the HelloWorld
program.
See servlet for instructions on how to install and
run it.
Note how it looks like ordinary HTML with dynamically generated variable content
Java code enclosed in <%= ... %>.
Learning More
 | Core Web Programming, Second Edition |
| 0-13-089793-0 |
| Marty Hall and Gary Cornell |
| 1250 pages. This is a great doorstop of a book. It has a few chapters on client-server programming in Java, and a section of that is on CGI. I have looked at hundreds of Java books and found nothing that deals in depth with client side Java talking to CGI, except Marty's book. It is really very simple and he does an excellent job of explaining it. Marty has posted all the source code examples from the book for anyone to use. These contain updates and errata fixes you don't get on the CD-ROM that comes with the book. |
|
|
 | Core Servlets and Java Server Pages |
| 0-13-089340-4 |
| Marty Hall |
| Complete text of the book available on line in pdf format. |
|
|
 | Core Servlets and Java Server Pages |
| 0-13-067614-4 |
| Marty Hall |
| Complete text of the book available on line in pdf format. |
|
|
 | Web Development with JavaServer Pages |
| 1-930110-12-X |
| Duane K. Fields, Mark A. Kolb, Shawn Bayern |
| A very thorough treatment. |
|
|
 | Java Servlet Programming |
| 0-596-00040-5 |
| Jason Hunter, William Crawford |
| highly reccommended. Covers basics of JSP too. |
|
|
 | Java 2 Enterprise Edition BibleJava 2 Enterprise Edition Bible |
| 0-7645-0882-2 |
| Justin Couch and Daniel H. Steinberg |
|
|
|
Alternatives To JSP
There are two basic alternatives to JSP:
-
Ones that also rely 100% on server side computing, such as Velocity,
Tea and Freemarker. There are scores of lemmings
all going for the fundamentally flawed, but easy to implement, 100% server side
solution. You can see a list of them under servlet
wombs.
-
Ones that use a combination of server side and client side computing such as Canoo.
Flash is about the only mainstream alternative, (unfortunately
non-Java), for the combined solution. I have written up a JSP
Replacer student project for an all-Java server-controlled client-side
validation environmnet.
I am not the only one who thinks JSP is not the greatest thing since sliced
bread. Check out these essays: