Consistency with JSP
By Al Williams
One of Java's biggest strengths is also its primary weakness: It runs everywhere. Sure, Java's cross-platform agility makes it attractive, but it also requires that every user have a properly installed Java virtual machine (JVM) that operates the way you expect it to work. Sometimes this can be a tall order. Does the user have Swing, or the latest version of JVM? I recently worked through the process of signing a Java applet and found that every Web browser requires a different procedure (and some don't allow signing at all).
You can control these platform problems by running all your Java code yourselfthat is, by using Java to generate HTML pages and serve them to the clients. Such server-side programming, whether with Java or other technologies, has become the technique of choice for many Web sites. Because you don't have to concern yourself with compatibility issues in each individual browser, you can control the environment and ensure that your programs will run correctly.
One way to incorporate Java into your Web server is to use servlets. I talked about servlets in the August 1998 "Java@Work." However, servlets require you to understand a lot about Javawriting one is about as complex as writing an applet. If you're a dyed-in-the-wool Java programmer, servlets probably don't scare you. However, if you're a Web-page author, writing a servlet can be a bit daunting.
That's where JavaServer Pages (JSP) enters the picture. JSP lets you write scripts that interweave Java code and HTML. The server (or a special extension to the server) compiles the JSP file into a servlet as needed.