【正文】
project, you will use servlets. For others, you will use JSP. For still others, you will bine them with the MVC architecture . You want the appropriate tool for the job, and servlets, by themselves, do not plete your toolkit. Advantages of JSP Over Competing Technologies A number of years ago, Marty was invited to attend a small 20person industry roundtable discussion on software technology. Sitting in the seat next to Marty was James Gosling, inventor of the Java programming language. Sitting several seats away was a highlevel manager from a 2 very large software pany in Redmond, Washington. During the discussion, the moderator brought up the subject of Jini, which at that time was a new Java technology. The moderator asked the manager what he thought of it, and the manager responded that it was too early to tell, but that it seemed to be an excellent idea. He went on to say that they would keep an eye on it, and if it seemed to be catching on, they would follow his pany39。s usual embrace and extend strategy. At this point, Gosling lightheartedly interjected You mean disgrace and distend. Now, the grievance that Gosling was airing was that he felt that this pany would take technology from other panies and suborn it for their own purposes. But guess what? The shoe is on the other foot here. The Java munity did not invent the idea of designing pages as a mixture of static HTML and dynamic code marked with special tags. For example, ColdFusion did it years earlier. Even ASP (a product from the very software pany of the aforementioned manager) popularized this approach before JSP came along and decided to jump on the bandwagon. In fact, JSP not only adopted the general idea, it even used many of the same special tags as ASP did. So, the question bees: why use JSP instead of one of these other technologies? Our first response is that we are not arguing that everyone should. Several of those other technologies are quite good and are reasonable options in some situations. In other situations, however, JSP is clearly better. Here are a few of the reasons. Versus .NET and Active Server Pages (ASP) .NET is welldesigned technology from Microsoft. is the part that directly petes with servlets and JSP. The advantages of JSP are twofold. First, JSP is portable to multiple operating systems and Web servers。t locked into deploying on Windows and IIS. Although the core .NET platform runs on a few nonWindows platforms, the ASP part does not. You cannot expect to deploy serious applications on multiple servers and operating systems. For some applications, this difference does not matter. For others, it matters greatly. Second, for some applications the choice of the underlying language matters greatly. For example, although .NET39。 with JSP you can use Java for the real code and are not tied to a particular server product. However, the current release of ColdFusion is within the context of a J2EE server, allowing developers to easily mix ColdFusion and servlet/JSP code. Versus PHP PHP (a recursive acronym for PHP: Hypertext Preprocessor) is a free, opensource, HTMLembedded scripting language that is somewhat similar to both ASP and JSP. One advantage of JSP is that the dynamic part is written in Java, which already has an extensive API for working, database access, distributed objects, and the like, whereas PHP requires learning an entirely new, less widely used language. A second advantage is that JSP is much more widely supported by tool and server vendors than is PHP. Versus Pure Servlets JSP doesn39。t, in principle, be acplished with servlets. In fact, JSP documents are automatically translated into servlets behin