外文资料JavaServer Pages OverviewJavaServer Pages (JSP) technology enables Web developers and designers to rapidly develop and easily maintain, information-rich, dynamic Web pages that leverage existing business systems. As part of the Java technology family, JSP technology enables rapid development of Web-based applications that are platform independent. JSP technology separates the user interface from content generation, enabling designers to change the overall page layout without altering the underlying dynamic content.Benefits for DevelopersIf you are a Web page developer or designer who is familiar with HTML, you can: Use JSP technology without having to learn the Java language: You can use JSP technology without learning how to write Java scriplets. Although scriptlets are no longer required to generate dynamic content, they are still supported to provide backward compatibility.Extend the JSP language: Java tag library developers and designers can extend the JSP language with "simple tag handlers," which utilize a new, much simpler and cleaner, tag extension API. This spurs the growing number of pluggable, reusable tag libraries available, which in turn reduces the amount of code needed to write powerful Web applications.Easily write and maintain pages: The JavaServer Pages Standard Tag Library (JSTL) expression language is now integrated into JSP technology and has been upgraded to support functions. The expression language can now be used instead of scriptlet expressions.JSP Technology and Java ServletsJSP technology uses XML-like tags that encapsulate the logic that generates the content for the page. The application logic can reside in server-based resources (such as JavaBeans component architecture) that the page accesses with these tags. Any and all formatting (HTML or XML) tags are passed directly back to the response page. By separating the page logic from its design and display and supporting a reusable component-based design, JSP technology makes it faster and easier than ever to build Web-based applications.JavaServer Pages technology is an extension of the Java Servlet technology. Servlets are platform-independent, server-side modules that fit seamlessly into a Web server framework and can be used to extend the capabilities of a Web server with minimal overhead, maintenance, and support. Unlike other scripting languages, servlets involve no platform-specific consideration or modifications; they are application components that are downloaded, on demand, to the part of the system that needs them. Together, JSP technology and servlets provide an attractive alternative to other types of dynamic Web scripting/programming by offering: platform independence; enhanced performance; separation of logic from display; ease of administration; extensibility into the enterprise; and, most importantly, ease of use.Today servlets are a popular choice for building interactive Web applications.Third-party servlet containers are available for Apache Web Server, Microsoft IIS, and others. Servlet containers are usually a component of Web and application servers, such as BEA WebLogic Application Server, IBM WebSphere, Sun Java System Web Server, Sun Java System Application Server, and others.Community BackgroundThe JSP specification is the product of industry-wide collaboration with industry leaders in the enterprise software and tools markets, led by Sun Microsystems. Sun has made the JSP specification freely available to the developer community, with the goal that every Web server and application server will support the JSP interface. JSP pages share the "Write Once, Run Anywhere" advantages of Java technology. JSP technology is a key component in the Java 2 Platform, Enterprise Edition, Sun's highly scalable architecture for enterprise applications.JSP Technology in the Java EE 5 PlatformThe focus of Java EE 5 has been ease of development by making use of Java language annotations that were introduced by J2SE 5.0. JSP 2.1 supports this goal by defining annotations for dependency injection on JSP tag handlers and context listeners. Another key concern of the Java EE 5 specification has been the alignment of its webtier technologies, namely JavaServer Pages (JSP), JavaServer Faces (JSF), and JavaServer Pages Standard Tag Library (JSTL).The outcome of this alignment effort has been the Unified Expression Language (EL), which integrates the expression languages defined by JSP 2.0 and JSF 1.1.The main key additions to the Unified EL that came out of tbe alignment work have been:A pluggable API for resolving variable references into Java objects and for resolving the properties applied to these Java objects,Support for deferred expressions, which may be evaluated by a tag handler when needed, unlike their regular expression counterparts, which get evaluated immediately when a page is executed and rendered, andSupport for lvalue expression, which appear on the left hand side of an assignment operation. When used as an lvalue, an EL expression represents a reference to a data structure, for example: a JavaBeans property, that is assigned some user input.The new Unified EL is defined in its own specification document, which is delivered along with the JSP 2.1 specification.Thanks to the Unified EL, JSTL tags, such as the JSTL iteration tags, can now be used with JSF components in an intuitive way.Java Servlet Technology OverviewServlets are the Java platform technology of choice for extending and enhancing Web servers. Servlets provide a component-based, platform-independent method for building Web-based applications, without the performance limitations of CGI programs. And unlike proprietary server extension mechanisms (such as the Netscape Server API or Apache modules), servlets are server- and platform-independent. This leaves you free to select a "best of breed" strategy for your servers, platforms, and tools.Servlets have access to the entire family of Java APIs, including the JDBC API to access enterprise databases. Servlets can also access a library of HTTP-specific calls and receive all the benefits of the mature Java language, including portability, performance, reusability, and crash protection.Today servlets are a popular choice for building interactive Web applications. Third-party servlet containers are available for Apache Web Server, Microsoft IIS, and others. Servlet containers are usually a component of Web and application servers, such as BEA WebLogic Application Server, IBM WebSphere, Sun Java System Web Server, Sun Java System Application Server, and others.You might want to check out the latest information on JavaServer Pages (JSP) technology. JSP technology is an extension of the servlet technology created to support authoring of HTML and XML pages. It makes it easier to combine fixed or static template data with dynamic content. Even if you're comfortable writing servlets, there are several compelling reasons to investigate JSP technology as a complementto your existing work.JavaBeansJavaBeans technology is the component architecture for the Java 2 Platform, Standard Edition (J2SE). Components (JavaBeans) are reusable software programs thatyou can develop and assemble easily to create sophisticated applications. JavaBeans technology is based on the JavaBeans specification.The Bean BuilderThe Bean Builder is a simple component assembler that demonstrates the visual construction of applications using component assembly mechanisms.JavaBeans Activation Framework (JAF)JAF lets you take advantage of standard services to: determine the type of an arbitrary piece of data; encapsulate access to it; discover the operations availableon it; and instantiate the appropriate bean to perform the operation(s).The Java 2 Enterprise Edition (J2EE) is a standard that defines an environment forthe development and deployment of enterprise applications. It reduces the cost and complexity of developing multitier enterprise applications as it provides amultitier distributed application model. In other words, it is inherently distributed and therefore the various parts of an application can run on different devices.Web applications developed using JavaServer Pages (JSP) may require some interaction with J2EE services. For example, a web-based inventory control system may need to access J2EE's directory services to gain access to a database. Or you may want touse Enterprise JavaBeans (EJB) in your application.This article presents a brief overview of J2EE, then it shows how to: Describe J2EE services in a Web Deployment Descriptor (web.xml)Reference J2EE servicesAccess and use J2EE services from JSPsOverview of J2EEThe J2EE is a standard platform for the development and deployment of enterprise applications. The architecture of J2EE, which is component-based, makes developingenterprise applications easy because business logic is organized into reusable components and the underlying service is provided by J2EE in the form of a container for every component type. Think of a container as the interface between the component and the low-level functionality that supports the component. Therefore, before an application client component can be executed, it must be configured as a J2EE service and deployed into its container.J2EE promotes the development of multitier applications in which the web container hosts web components that are dedicated to handling a given application's presentation logic, and responds to requests from the client (such as the web browser). The EJB container, on the other hand, hosts application components that respond to requests from the web tier as shown in Figure 1.Figure 1: Multitier ApplicationsApplications that use this architecture are implicitly scalable. This architecture decouples the accessing of data from end-user interactions, and encourages component-based code reusability. At the web tier, J2EE promotes the use of JSPs for the creation of dynamic content for Web clients.Custom Tags and J2EEJ2EE has a lot to offer to Web application developers and the JSP custom tag developer. As you can see from Table 1 above, it has a rich set of standard APIs for sending email, accessing databases, parsing XML documents, and so on. Your Web applications can benefit greatly from these APIs. For example, you can write a JSP custom tag for sending email that can be used easily by Web content developers who are not familiar with Java. If you are not familiar with JSP custom tags, their benefits, and how to create them, please refer to Developing JSP Custom Tags.外文资料译文Javaserverpages概况Javaserverpages(jsp)技术,使Web开发人员和设计师可以快速开发和易于维护,利用现有的业务系统的动态网页使信息丰富。