JSP技术中英文对照外文翻译文献

合集下载

计算机 JSP web 外文翻译 外文文献

计算机 JSP web 外文翻译 外文文献

计算机 JSP web 外文翻译外文文献12.1 nEffective web n design involves separating business objects。

n。

and object XXX。

Although one individual may handle both roles on a small-scale project。

it is XXX.12.2 JSP ArchitectureIn this chapter。

XXX using JavaServer Pages。

servlets。

XXX of different architectures。

each building upon the us one。

The diagram below outlines this process。

and we will explain each component in detail later in this article.Note: XXX.)When Java Server Pages were introduced by Sun。

some people XXX。

While JSP is a key component of the J2EE n and serves as the preferred request handler and response mechanism。

it is XXX.XXX JSP。

the XXX that JSP is built on top of the servlet API and uses servlet XXX interesting ns。

such as whether we should XXX in our Web-enabled systems。

and if there is a way to combine servlets and JSPs。

jsp技术网站设计外文翻译(适用于毕业论文外文翻译+中英文对照)

jsp技术网站设计外文翻译(适用于毕业论文外文翻译+中英文对照)

Combining JSP and ServletsThe technology of JSP and Servlet is the most important technology which use Java technology to exploit request of server, and it is also the standard which exploit business application .Java developers prefer to use it for a variety of reasons, one of which is already familiar with the Java language for the development of this technology are easy to learn Java to the other is "a preparation, run everywhere" to bring the concept of Web applications, To achieve a "one-prepared everywhere realized." And more importantly, if followed some of the principles of good design, it can be said of separating and content to create high-quality, reusable, easy to maintain and modify the application. For example, if the document in HTML embedded Java code too much (script), will lead the developed application is extremely complex, difficult to read, it is not easy reuse, but also for future maintenance and modification will also cause difficulties. In fact, CSDN the JSP / Servlet forum, can often see some questions, the code is very long, can logic is not very clear, a large number of HTML and Java code mixed together. This is the random development of the defects.Early dynamic pages mainly CGI (Common Gateway Interface, public Gateway Interface) technology, you can use different languages of the CGI programs, such as VB, C / C + + or Delphi, and so on. Though the technology of CGI is developed and powerful, because of difficulties in programming, and low efficiency, modify complex shortcomings,it is gradually being replaced by the trend. Of all the new technology, JSP / Servlet with more efficient and easy to program, more powerful, more secure and has a good portability, they have been many people believe that the future is the most dynamic site of the future development of technology.Similar to CGI, Servlet support request / response model. When a customer submit a request to the server, the server presented the request Servlet, Servlet responsible for handling requests and generate a response, and then gave the server, and then from the server sent to the customer. And the CGI is different, Servlet not generate a new process, but with HTTP Server at the same process. It threads through the use of technology, reduce the server costs. Servlet handling of the request process is this: When received from the client's request, calling service methods, the method of Servlet arrival of the first judgement is what type of request (GET / POST / HEAD…), then calls the appropriate treatment (DoGet / doPos t / doHead…) and generate a response.Although such a complex, in fact, simply said to Servlet is a Java class. And the general category of the difference is that this type operating in a Servlet container, which can provide session management and targeted life-cycle management. So that when you use the Servlet, you can get all the benefits of the Java platform, including the safety of the management, use JDBC access the database and cross-platform capability. Moreover, Servlet using thread, and can develop more efficient Web applications.JSP technology is a key J2EE technology, it at a higher level of abstraction of a Servlet.It allows conventional static and dynamic HTML content generated by combining an HTML page looks like, but as a Servlet to run. There are many commercial application server support JSP technology, such as BEA WebLogic, IBM WebSphere, JRun, and so on. JSP and Servlet use more than simple. If you have a JSP support for Web servers, and a JSP document, you can put it Fangdao any static HTML files can be placed, do not have to compile, do not have to pack, do not have to ClassPath settings, you can visit as ordinary Web It did visit, the server will automatically help you to do other work.JSP document looks like an ordinary static HTML document, but inside contains a number of Java code. It uses. Jsp the suffix, used to tell the server this document in need of special treatment. When we visit a JSP page, the document will first be translated into a JSP engine Java source files, is actually a Servlet, and compiler, and then, like other Servlet, from Servlet engine to handle. Servlet engine of this type loading, handling requests from customers, and the results returned to the customer, as shown below:Figure 1: Calling the process of JSP pagesAfter another visit this page to the customer, as long as the paper there have been no changes, JSP engine has been loaded directly call the Servlet. If you have already been modified, it will be once again the implementation of the above process, translate, compile and load. In fact, this is the so-called "first person to punishment." Because when the first visit to the implementation of a series of the above process, so will spend some time after such a visit would not.Java servlets offer a powerful API that provides access to all the information about the request, the session, and the application. combining JSP with servlets lets you clearly separate the application logic from the presentation of the application; in other words, it lets you use the most appropriate component type for the roles of Model, View and Controller.Servlets, Filters, and ListenersA servlet is a Java class that extends a server with functionality for processing a request and producing a response. It's implemented using the classes and interfaces defined by the Servlet API. The API consists of two packages: the javax.servlet package contains classes and interfaces that are protocol-independent, while the javax.servlet.http package provides HTTP-specific extensions and utility classes.What makes a servlet a servlet is that the class implements an interface named javax.servlet.Servlet, either directly or by extending one of the support classes. This interface defines the methods used by the web container to manage and interact with theservlet. A servlet for processing HTTP requests typically extends the javax.servlet.http.HttpServlet class. This class implements the Servlet interface and provides additional methods suitable for HTTP processing.Servlet LifecycleThe web container manages all aspects of the servlet's lifecycle. It creates an instance of the servlet class when needed, passes requests to the instance for processing, and eventually removes the instance. For an HttpServlet, the container calls the following methods at the appropriate times in the servlet lifecycle.Besides the doGet( ) and doPost( ) methods, there are methods corresponding to the other HTTP methods: doDelete( ), doHead( ), doOptions( ), doPut( ), and doTrace( ). Typically you don't implement these methods; the HttpServlet class already takes care of HEAD, OPTIONS, and TRACE requests in a way that's suitable for most servlets, and the DELETE and PUT HTTP methods are rarely used in a web application.It's important to realize that the container creates only one instance of each servlet. This means that the servlet must be thread safe -- able to handle multiple requests at the same time, each executing as a separate thread through the servlet code. Without getting lost in details, you satisfy this requirement with regards to instance variables if you modify the referenced objects only in the init( ) and destroy( ) methods, and just read them in the request processing methods.Compiling and Installing a ServletTo compile a servlet, you must first ensure that you have the JAR file containing all Servlet API classes in the CLASSPATH environment variable. The JAR file is distributed with all web containers. Tomcat includes it in a file called servlet.jar, located in the common/lib directory. On a Windows platform, you include the JAR file in the CLASSPATH.. Reading a RequestOne of the arguments passed to the doGet( ) and doPost( ) methods is an object that implements the HttpServletRequest interface. This interface defines methods that provide access to a wealth of information about the request.Generating a ResponseBesides the request object, the container passes an object that implements the HttpServletResponse interface as an argument to the doGet( ) and doPost( ) methods. This interface defines methods for getting a writer or stream for the response body. It also defines methods for setting the response status code and headers.Using Filters and ListenersThe servlet specification defines two component types beside servlets: filters and listeners. These two types were introduced in the Servlet 2.3 specification, so if you're using a container that doesn't yet support this version of the specification, I'm afraid you'reout of luck.FiltersA filter is a component that can intercept a request targeted for a servlet, JSP page, or static page, as well as the response before it's sent to the client. This makes it easy to centralize tasks that apply to all requests, such as access control, logging, and charging for the content or the services offered by the application. A filter has full access to the body and headers of the request and response, so it can also perform various transformations. One example is compressing the response body if the Accept-Language request header indicates that the client can handle a compressed response.A filter can be applied to either a specific servlet or to all requests matching a URL pattern, such as URLs starting with the same path elements or having the same extension. ListenersListeners allow your application to react to certain events. Prior to Servlet 2.3, you could handle only session attribute binding events (triggered when an object was added or removed from a session). You could do this by letting the object saved as a sessionattribute(using the HttpSession.setAttribute() method)implement the HttpSessionBindingListener interface. With the new interfaces introduced in the 2.3 version of the specification, you can create listeners for servlet context and session lifecycle events as well as session activation and passivation events (used by a container that temporarily saves session state to disk or migrates a session to another server). A newsession attribute event listener also makes it possible to deal with attribute binding events for all sessions in one place, instead of placing individual listener objects in each session.The new types of listeners follow the standard Java event model. In other words, a listener is a class that implements one or more of the listener interfaces. The interfaces define methods that correspond to events. The listener class is registered with the container when the application starts, and the container then calls the event methods at the appropriate times.Initializing Shared Resources Using a ListenerBeans like this typically need to be initialized before they can be used. For instance, they may need a reference to a database or some other external data source and may create an initial information cache in memory to provide fast access even to the first request for data. You can include code for initialization of the shared resources in the servlet and JSP pages that need them, but a more modular approach is to place all this code in one place and let the other parts of the application work on the assumption that the resources are already initialized and available. An application lifecycle listener is a perfect tool for this type of resource initialization. This type of listener implements the javax.servlet.ServletContextListener interface, with methods called by the container when the application starts and when it shuts down.Picking the Right Component Type for Each TaskThe Project Billboard application introduced is a fairly complex application. Half thepages are pure controller and business logic processing, it accesses a database to authenticate users, and most pages require access control. In real life, it would likely contain even more pages, for instance, pages for access to a shared document archive, time schedules, and a set of pages for administration. As the application evolves, it may become hard to maintain as a pure JSP application. It's easy to forget to include the access control code in new pages.This is clearly an application that can benefit from using a combination of JSP pages and the component types defined by the servlet specification for the MVC roles. Let's look at the main requirements and see how we can map them to appropriate component types:●Database access should be abstracted, to avoid knowledge of a specific dataschema or database engine in more than one part of the application: beans in therole of Model can be used to accomplish this.●The database access beans must be made available to all other parts of theapplication when it starts: an application lifecycle event listener is the perfectcomponent type for this task.●Only authenticated users must be allowed to use the application: a filter canperform access control to satisfy this requirement.●Request processing is best done with Java code: a servlet, acting as the Controller,fits the bill.●It must be easy to change the presentation: this is where JSP shines, acting as theView.Adding servlets, listeners, and filters to the mix minimizes the need for complex logic in the JSP pages. Placing all this code in Java classes instead makes it possible to use a regular Java compiler and debugger to fix potential problems.Centralized Request Processing Using a ServletWith a servlet as the common entry point for all application requests, you gain control over the page flow of the application. The servlet can decide which type of response to generate depending on the outcome of the requested action, such as returning a common error page for all requests that fail, or different responses depending on the type of client making the request. With the help from some utility classes, it can also provide services such as input validation, I18N preparations, and in general, encourage a more streamlined approach to request handling.When you use a servlet as a Controller, you must deal with the following basic requirements:●All requests for processing must be passed to the single Controller servlet.●The servlet must be able to distinguish requests for different types of processing.Here are other features you will want support for, even though they may not be requirements for all applications:● A strategy for extending the application to support new types of processingA mechanism for changing the page flow of the application without modifyingcode.Mapping Application Requests to the ServletThe first requirement for using a Controller servlet is that all requests must pass through it. This can be satisfied in many ways. If you have played around a bit with servlets previously, you're probably used to invoking a servlet with a URI that starts with /myApp/servlet. This is a convention introduced by Suns Java Web Server (JWS), the first product to support servlets before the API was standardized. Most servlet containers support this convention today, even though it's not formally defined in the servlet specification.将Servlet和JSP组合使用Servlet和JSP技术是用Java开发服务器端应用的主要技术,是开发商务应用表示端的标准。

JSP及其WEB技术毕业设计论文中英文资料对照外文翻译文献

JSP及其WEB技术毕业设计论文中英文资料对照外文翻译文献

中英文资料对照外文翻译文献JSP及其WEB技术. 1 JSP简介JSP(JavaServer Pages)是一种基于Java的脚本技术。

是由Sun Microsystems 公司倡导、许多公司参与一起建立的一种动态网页技术标准。

JSP技术有点类似ASP 技术,它是在传统的网页HTML文件(*.htm,*.html)中插入Java程序段(Scriptlet)和JSP标记(tag),从而形成JSP文件(*.jsp)。

用JSP开发的Web应用是跨平台的,即能在Linux下运行,也能在其他操作系统上运行。

在JSP 的众多优点之中,其中之一是它能将 HTML 编码从 Web 页面的业务逻辑中有效地分离出来。

用 JSP 访问可重用的组件,如 Servlet、JavaBean 和基于 Java 的 Web 应用程序。

JSP 还支持在Web 页面中直接嵌入 Java 代码。

可用两种方法访问 JSP 文件:浏览器发送 JSP 文件请求、发送至 Servlet 的请求。

JSP技术使用Java编程语言编写类XML的tags 和scriptlets,来封装产生动态网页的处理逻辑。

网页还能通过tags和scriptlets 访问存在于服务端的资源的应用逻辑。

JSP将网页逻辑与网页设计和显示分离,支持可重用的基于组件的设计,使基于Web的应用程序的开发变得迅速和容易。

Web服务器在遇到访问JSP网页的请求时,首先执行其中的程序段,然后将执行结果连同JSP文件中的HTML代码一起返回给客户。

插入的Java程序段可以操作数据库、重新定向网页等,以实现建立动态网页所需要的功能。

JSP与Java Servlet一样,是在服务器端执行的,通常返回该客户端的就是一个HTML文本,因此客户端只要有浏览器就能浏览。

JSP页面由HTML代码和嵌入其中的Java代码所组成。

服务器在页面被客户端请求以后对这些Java代码进行处理,然后将生成的HTML页面返回给客户端的浏览器。

外文文献—JSP的优势

外文文献—JSP的优势

附录I 英文翻译1、英文部分Benefits of JSPJSP pages are translated into servlets. So, fundamentally, any task JSP pages can perform could also be accomplished by servlets. However, this underlying equivalence does not mean that servlets and JSP pages are equally appropriate in all scenarios. The issue is not the power of the technology, it is the convenience, productivity, and maintainability of one or the other. After all, anything you can do on a particular computer platform in the Java programming language you could also do in assembly language. But it still matters which you choose..JSP provides the following benefits over servlets alone:• It is easier to write and maintain the HTML. Your static code is ordinary HTML: no extra backslashes, no double quotes, and no lurking Java syntax.• You can use standard Web-site development tools. Even HTML tools that know nothing about JSP can be used because they simply ignore the JSP tags• You can divide up your development team. The Java programmers can w ork on the dynamic code. The Web developers can concentrate on the presentation layer. On large projects, this division is very important. Depending on the size of your team and the complexity of your project, you can enforce a weaker or stronger separation between the static HTML and the dynamic content.Now, this discussion is not to say that you should stop using servlets and use only JSP instead. By no means. Almost all projects will use both. For some requests in your project, you will use servlets. For others, you will use JSP. For still others, you will combine them with the MVC architecture . You want the appropriate tool for the job, and servlets, by themselves, do not complete your toolkitAdvantages of JSP Over Competing TechnologiesA number of years ago, Marty was invited to attend a small 20-person 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 high-level manager from a very large software company 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 company'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 company would take technology from other companies and suborn it for their own purposes. But guess what? The shoe is on the other foot here. The Java community 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 company of the aforementioned manager) popularized this approach before JSP came along and decided to jump on thebandwagon. In fact, JSP not only adopted the general idea, it even used many of the same special tags as ASP did.So, the question becomes: 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 well-designed technology from Microsoft. is the part that directly competes with servlets and JSP. The advantages of JSP are twofoldFirst, JSP is portable to multiple operating systems and Web servers; you aren't locked into deploying on Windows and IIS. Although the core .NET platform runs on a few non-Windows 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 .NET's C# language is very well designed and is similar to Java, fewer programmers are familiar with either the core C# syntax or the many auxiliary libraries. In addition, many developers still use the original version of ASP. With this version, JSP has a clear advantage for the dynamic code. With JSP, the dynamic part is written in Java, not VBScript or another ASP-specific language, so JSP is more powerful and better suited to complex applications that require reusable componentsYou could make the same argument when comparing JSP to the previous version of ColdFusion; 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 PHPPHP (a recursive acronym for "PHP: Hypertext Preprocessor") is a free, open-source, HTML-embedded 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 networking, 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 ServletsJSP doesn't provide any capabilities that couldn't, in principle, be accomplished with servlets. In fact, JSP documents are automatically translated into servlets behind the scenes. But it is more convenient to write (and to modify!) regular HTML than to use a zillion println statements to generate the HTML. Plus, by separating the presentation from the content, you can put different people on different tasks: your Web page design experts can build the HTML by using familiar tools and either leave places for your servlet programmers to insert the dynamic content or invoke the dynamic content indirectly by means of XML tags.Does this mean that you can just learn JSP and forget about servlets? Absolutely not! JSP developers need to know servlets for four reasons:1. JSP pages get translated into servlets. You can't understand how JSP works without understanding servlets.2. JSP consists of static HTML, special-purpose JSP tags, and Java code. What kind of Java code? Servlet code! You can't write that code if you don't understand servlet programming3. Some tasks are better accomplished by servlets than by JSP. JSP is good at generating pages that consist of large sections of fairly well structured HTML or other character data. Servlets are better for generating binary data, building pages with highly variable structure, and performing tasks (such as redirection) that involve little or no output.4. Some tasks are better accomplished by a combination of servlets and JSP than by either servlets or JSP alone.Versus JavaScriptJavaScript, which is completely distinct from the Java programming language, is normally used to dynamically generate HTML on the client, building parts of the Web page as the browser loads the document. This is a useful capability and does not normally overlap with the capabilities of JSP (which runs only on the server). JSP pages still include SCRIPT tags for JavaScript, just as normal HTML pages do. In fact, JSP can even be used to dynamically generate the JavaScript that will be sent to the client. So, JavaScript is not a competing technology; it is a complementary one.It is also possible to use JavaScript on the server, most notably on Sun ONE (formerly iPlanet), IIS, and BroadVision servers. However, Java is more powerful, flexible, reliable, and portable.Versus WebMacro or VelocityJSP is by no means perfect. Many people have pointed out features that could be improved. This is a good thing, and one of the advantages of JSP is that the specification is controlled by a community that draws from many different companies. So, the technology can incorporate improvements in successive releasesHowever, some groups have developed alternative Java-based technologies to try to address these deficiencies. This, in our judgment, is a mistake. Using a third-party tool like Apache Struts that augments JSP and servlet technology is a good idea when that tool adds sufficient benefit to compensate for the additional complexity. But using a nonstandard tool that tries to replace JSP is a bad idea. When choosing a technology, you need to weigh many factors: standardization, portability, integration, industry support, and technical features. The arguments for JSP alternatives have focused almost exclusively on the technical features part. But portability, standardization, and integration are also very important. For example, the servlet and JSP specifications define a standard directory structure for Web applications and provide standard files (.war files) for deploying Web applications. All JSP-compatible servers must support these standards. Filters can be set up to apply to any number of servlets or JSP pages, but not to nonstandard resources. The same goes for Web application security settings.Besides, the tremendous industry support for JSP and servlet technology results in improvements that mitigate many of the criticisms of JSP. For example, the JSP Standard Tag Library and the JSP 2.0 expression language address two of the most well-founded criticisms: the lack of good iteration constructs and the difficulty of accessing dynamic results without using either explicit Java code or verbose jsp:useBean elementsForgetting JSP Is Server-Side TechnologyHere are some typical questions Marty has received (most of them repeatedly)• Our server is running JDK 1.4. So, how do I put a Swing component in a JSP page?• How do I put an image into a JSP page? I do not know the proper Java I/O commands to read image files• Since Tomcat does not support JavaScript, how do I make images that are highlighted when the user moves the mouse over them?• Our clients use older browsers that do not understand JSP. What should we do?• When our clients use "View Source" in a browser, how can I prevent them from seeing the JSP tags?All of these questions are based upon the assumption that browsers know something about the server-side process. But they do not. Thus:• For putting applets with Swing components into Web pages, what matters is the browser's Java version—the server's version is irrelevant. If the browser supports the Java 2 platform, you use the normal APPLET (or Java plug-in) tag and would do so even if you were using non-Java technology on the server.• You do not need Java I/O to read image files; you just put the i mage in the directory for Web resources (i.e., two levels up from WEB-INF/classes) and output a normal IMG tag • You create images that change under the mouse by using client-side JavaScript, referenced with the SCRIPT tag; this does not change just because the server is using JSP• Browsers do not "support" JSP at all—they merely see the output of the JSP page. So, make sure your JSP outputs HTML compatible with the browser, just as you would do with static HTML pages.• And, of course you need not do anyt hing to prevent clients from seeing JSP tags; those tags are processed on the server and are not part of the output that is sent to the client.Confusing Translation Time with Request TimeA JSP page is converted into a servlet. The servlet is compiled, loaded into the server's memory, initialized, and executed. But which step happens when? To answer that question, remember two points:• The JSP page is translated into a servlet and compiled only the first time it is accessed after having been modified.• L oading into memory, initialization, and execution follow the normal rules for servlets.2、中文部分:JSP的优势JSP页面最终会转换成servler。

JSP应用框架外文文献

JSP应用框架外文文献

附录Ⅰ英文资料翻译英文原文JSP Application FrameworksWhat are application frameworks:A framework is a reusable, semi-complete application that can be specialized to produce custom applications [Johnson]. Like people, software applications are more alike than they are different. They run on the same computers, expect input from the same devices, output to the same displays, and save data to the same hard disks. Developers working on conventional desktop applications are accustomed to toolkits and development environments that leverage the sameness between applications. Application frameworks build on this common ground to provide developers with a reusable structure that can serve as the foundation for their own products.A framework provides developers with a set of backbone components that have the following characteristics:1. They are known to work well in other applications.2. They are ready to use with the next project.3. They can also be used by other teams in the organization.Frameworks are the classic build-versus-buy proposition. If you build it, you will understand it when you are done—but how long will it be before you can roll your own? If you buy it, you will have to climb the learning curve—and how long is that going to take? There is no right answer here, but most observers would agree that frameworks such as Struts provide a significant return on investment compared to starting from scratch, especially for larger projects.Other types of frameworks:The idea of a framework applies not only to applications but to application components as well. Throughout this article, we introduce other types of frameworks that you can use with Struts. These include the Lucene search engine, the Scaffold toolkit, the Struts validator, and the Tiles tag library. Like application frameworks, these tools provide semi-complete versions of a subsystem that can be specialized to provide a custom component.Some frameworks have been linked to a proprietary development environment. This is not the case with Struts or any of the other frameworks shown in this book. You can use any development environment with Struts: Visual Age for Java, JBuilder, Eclipse, Emacs, and Textpad are all popular choices among Struts developers. If you can use it with Java, you can use it with Struts.Enabling technologies:Applications developed with Struts are based on a number of enabling technologies. These components are not specific to Struts and underlie every Java web application. A reason that developers use frameworks like Struts is to hide the nasty details behind acronyms like HTTP, CGI, and JSP. As a Struts developer, you don’t need to be an alphabet soup guru, but a working knowledge of these base technologies can help you devise creative solutions to tricky problems.Hypertext Transfer Protocol (HTTP):When mediating talks between nations, diplomats often follow a formal protocol.Diplomatic protocols are designed to avoid misunderstandings and to keep negotiations from breaking down. In a similar vein, when computers need to talk, they also follow a formal protocol. The protocol defines how data is transmitted and how to decode it once it arrives. Web applications use the Hypertext Transfer Protocol (HTTP) to move data between the browser running on your computer and the application running on the server.Many server applications communicate using protocols other than HTTP. Some of these maintain an ongoing connection between the computers. The application server knows exactly who is connected at all times and can tell when a connection is dropped. Because they know the state of each connection and the identity of each person using it, these are known as stateful protocols.By contrast, HTTP is known as a stateless protocol. An HTTP server will accept any request from any client and will always provide some type of response, even if the response is just to say no. Without the overhead of negotiating and retaining a connection, stateless protocols can handle a large volume of requests. This is one reason why the Internet has been able to scale to millions of computers.Another reason HTTP has become the universal standard is its simplicity. An HTTP request looks like an ordinary text document. This has made it easy for applications to make HTTP requests.You can even send an HTTP request by hand using a standard utility such as Telnet. When the HTTP response comes back, it is also in plain text that developers can read.The first line in the HTTP request contains the method, followed by the location of the requested resource and the version of HTTP. Zero or more HTTP request headers follow the initial line. The HTTP headers provide additional information to the server. This can include the browser type and version, acceptable document types, and the browser’s cookies, just to name a few. Of t he seven request methods, GET and POST are by far the most popular.Once the server has received and serviced the request, it will issue an HTTP response. The first line in the response is called the status line and carries the HTTP protocol version, a numeric status, and a brief description of the status. Following the status line, the server will return a set of HTTP response headers that work in a way similar to the request headers.As we mentioned, HTTP does not preserve state information between requests. The server logs the request, sends the response, and goes blissfully on to the next request. While simple and efficient, a stateless protocol is problematic for dynamic applications that need to keep track of their users. (Ignorance is not always bliss.Cookies and URL rewriting are two common ways to keep track of users between requests. A cookie is a special packet of information on the user’s computer. URL rewriting stores a special reference in the page address that a Java server can use to track users. Neither approach is seamless, and using either means extra work when developing a web application. On its own, a standard HTTP web server does not traffic in dynamic content. It mainly uses the request to locate a file and then returns that file in the response. The file is typically formatted using Hypertext Markup Language (HTML) [W3C, HTML] that the web browser can format and display. The HTML page often includes hypertext links to other web pages and may display any number of other goodies, such as images and videos. The user clicks a link to make another request, and the process begins a new.Standard web servers handle static content and images quite well but need a helping hand to provide users with a customized, dynamic response.DEFINITION: Static content on the Web comes directly from text or data files, like HTML or JPEG files. These files might be changed from time to time, but they are not altered automaticallywhen requested by a web browser. Dynamic content, on the other hand, is generated on the fly, typically in response to an individualized request from a browser.Common Gateway Interface (CGI):The first widely used standard for producing dynamic content was the Common Gateway Interface (CGI). CGI uses standard operating system features, such as environment variables and standard input and output, to create a bridge, or gateway, between the web server and other applications on the host machine. The other applications can look at the request sent to them by the web server and create a customized response.When a web server receives a request that’s intended for a CGI program, it runs that program and provides the program with information from the incoming request. The CGI program runs and sends its output back to the server. The web server then relays the response to the browser.CGI defines a set of conventions regarding what information it will pass as environment variables and how it expects standard input and output to be used. Like HTTP, CGI is flexible and easy to implement, and a great number of CGI-aware programs have been written.The main drawback to CGI is that it must run a new copy of the CGI-aware program for each request. This is a relatively expensive process that can bog down high-volume sites where thousands of requests are serviced per minute. Another drawback is that CGI programs tend to be platform dependent. A CGI program written for one operating system may not run on another.Java servlets:Sun’s Java Servlet platform directly addresses the two main drawbacks of CGI , servlets offer better performance and utilization of resources than conventional CGI programs. Second, the write-once, run-anywhere nature of Java means that servlets are portable between operating systems that have a Java Virtual Machine (JVM).A servlet looks and feels like a miniature web server. It receives a request and renders a response. But, unlike conventional web servers, the servlet application programming interface (API) is specifically designed to help Java developers create dynamic applications.The servlet itself is simply a Java class that has been compiled into byte code, like any other Java object. The servlet has access to a rich API of HTTP-specific services, but it is still just another Java object running in an application and can leverage all your other Java assets.To give conventional web servers access to servlets, the servlets are plugged into containers. The servlet container is attached to the web server. Each servlet can declare what URL patterns it would like to handle. When a request matching a registered pattern arrives, the web server passes the request to the container, and the container invokes the servlet.But unlike CGI programs, a new servlet is not created for each request. Once the container instantiates the servlet, it will just create a new thread for each request. Java threads are much less expensive than the server processes used by CGI programs. Once the servlet has been created, using it for additional requests incurs very little overhead. Servlet developers can use the init() method to hold references to expensive resources, such as database connections or EJB Home Interfaces, so that they can be shared between requests. Acquiring resources like these can take several seconds—which is longer than many surfers are willing to wait.The other edge of the sword is that, since servlets are multithreaded, servlet developers must take special care to be sure their servlets are thread-safe. To learn more about servlet programming, we recommend Java Servlets by Example, by Alan R. Williamson [Williamson]. The definitive source for Servlet information is the Java Servlet Specification [Sun, JST].JavaServer Pages:While Java servlets are a big step up from CGI programs, they are not a panacea. To generate the response, developers are still stuck with using println statements to render the HTML. Code that looks like:("<P>One line of HTML.</P>");("<P>Another line of HTML.</P>");is all too common in servlets that generate the HTTP response. There are libraries that can help you generate HTML, but as applications grow more complex, Java developers end up being cast into the role of HTML page designers.Meanwhile, given the choice, most project managers prefer to divide development teams into specialized groups. They like HTML designers to be working on the presentation while Java engineers sweat the business logic. Using servlets alone encourages mixing markup with business logic, making it difficult for team members to specialize.To solve this problem, Sun turned to the idea of using server pages to combine scripting and templating technologies into a single component. To build Java Server Pages, developers start by creating HTML pages in the same old way, using the same old HTML syntax. To bring dynamic content into the page, the developer can also place JSP scripting elements on the page. Scripting elements are tags that encapsulate logic that is recognized by the JSP. You can easily pick out scripting elements on JSP pages by looking for code that begins with <% and ends with %>.To be seen as a JSP page, the file just needs to be saved with an extension of .jsp.When a client requests the JSP page, the container translates the page into a source code file for a Java servlet and compiles the source into a Java class file—just as you would do if you were writing a servlet from scratch. At runtime, the container can also check the last modified date of the JSP file against the class file. If the JSP file has changed since it was last compiled, the container will retranslate and rebuild the page all over again.Project managers can now assign the presentation layer to HTML developers, who then pass on their work to Java developers to complete the business-logic portion. The important thing to remember is that a JSP page is really just a servlet. Anything you can do with a servlet, you can do with a JSP.JavaBeans:JavaBeans are Java classes which conform to a set of design patterns that make them easier to use with development tools and other components.DEFINITION A JavaBean is a reusable software component written in Java. To qualify as a JavaBean, the class must be concrete and public, and have a noargument constructor. JavaBeans expose internal fields as properties by providing public methods that follow a consistent design pattern. Knowing that the property names follow this pattern, other Java classes are able to use introspection to discover and manipulate JavaBean properties.The JavaBean design patterns provide access to the bean’s internal state through two flavors of methods: accessors are used to read a JavaBean’s state; mutators are used to change a JavaBean’s state.Mutators are always prefixed with lowercase token set followed by the property name. The first character in the property name must be uppercase. The return value is always void—mutators onlychange property values; they do not retrieve them. The mutator for a simple property takes only one parameter in its signature, which can be of any type. Mutators are often nicknamed setters after their prefix. The mutator method signature for a weight property of the type Double would be: public void setWeight(Double weight)A similar design pattern is used to create the accessor method signature. Accessor methods are always prefixed with the lowercase token get, followed by the property name. The first character in the property name must be uppercase. The return value will match the method parameter in the corresponding mutator. Accessors for simple properties cannot accept parameters in their method signature. Not surprisingly, accessors are often called getters.The accessor method signature for our weight property is:public Double getWeight()If the accessor returns a logical value, there is a variant pattern. Instead of using the lowercase token get, a logical property can use the prefix is, followed by the property name. The first character in the property name must be uppercase. The return value will always be a logical value—either boolean or Boolean. Logical accessors cannot accept parameters in their method signature.The boolean accessor method signature for an on property would bepublic boolean isOn()The canonical method signatures play an important role when working with Java- Beans. Other components are able to use the Java Reflection API to discover a Jav aBean’s properties by looking for methods prefixed by set, is, or get. If a component finds such a signature on a JavaBean, it knows that the method can be used to access or change the bean’s properties.Sun introduced JavaBeans to work with GUI components, but they are now used with every aspect of Java development, including web applications. When Sun engineers developed the JSP tag extension classes, they designed them to work with JavaBeans. The dynamic data for a page can be passed as a JavaBean, and t he JSP tag can then use the bean’s properties to customize the output.For more on JavaBeans, we highly recommend The Awesome Power of JavaBeans, by Lawrence H. Rodrigues [Rodrigues]. The definitive source for JavaBean information is the JavaBean Specification [Sun, JBS].Model 2:The release of the Servlet/JSP Specification described Model 2 as an architecture that uses servlets and JSP pages together in the same application. The term Model 2 disappeared from later releases, but it remains in popular use among Java web developers.Under Model 2, servlets handle the data access and navigational flow, while JSP pages handle the presentation. Model 2 lets Java engineers and HTML developers each work on their own part of the application. A change in one part of a Model 2 application does not mandate a change to another part of the application. HTML developers can often change the look and feel of an application without changing how the back-office servlets work.The Struts framework is based on the Model 2 architecture. It provides a controller servlet to handle the navigational flow and special classes to help with the data access. A substantial custom tag library is bundled with the framework to make Struts easy to use with JSP pages.Summary:In this article, we introduced Struts as an application framework. We examined the technology behind HTTP, the Common Gateway Interface, Java servlets, JSPs, and JavaBeans. We also looked at the Model 2 application architecture to see how it is used to combine servlets and JSPs in the same application.中文翻译JSP 应用框架什么是应用框架:框架(framework)是可重用的,半成品的应用程序,能够用来产生专门的定制程序。

JSP的技术发展历史外文翻译论文

JSP的技术发展历史外文翻译论文

THE TECHNIQUE DEVELOPMENT HISTORY OF JSPBy:Kathy Sierra and Bert BatesSource: Servlet&JSPThe Java Server Pages( JSP) is a kind of according to web of the script plait distance technique, similar carries the script language of Java in the server of the Netscape company of server- side JavaScript( SSJS) and the Active Server Pages(ASP) of the Microsoft. JSP compares the SSJS and ASP to have better can expand sex, and it is no more exclusive than any factory or some one particular server of Web. Though the norm of JSP is to be draw up by the Sun company of, any factory can carry out the JSP on own system.The After Sun release the JS P( the Java Server Pages) formally, the this kind of new Web application development technique very quickly caused the people's concern. JSP provided a special development environment for the Web application that establishes the high dynamic state. According to the Sun parlance, the JSP can adapt to include the Apache WebServer, IIS4.0 on the market at inside of 85% server product.This chapter will introduce the related knowledge of JSP and Databases, and JavaBean related contents.1.1 GENER ALIZEThe JSP(Java Server Pages) is from the company of Sun Microsystems initiate, the many companies the participate to the build up the together of the a kind the of dynamic the state web the page technique standard, the it have the it in the construction the of the dynamic state the web page the strong but the do not the especially of the function. JSP and the technique of ASP of the Microsoft is very alike. Both all provide the ability that mixes with a certain procedure code and is explain by thelanguage engine to carry out the procedure code in the code of HTML. Underneath we are simple of carry on the introduction to it.JSP pages are translated into servlets. So, fundamentally, any task JSP pages can perform could also be accomplished by servlets. However, this underlying equivalence does not mean that servlets and JSP pages are equally appropriate in all scenarios. The issue is not the power of the technology, it is the convenience, productivity, and maintainability of one or the other. After all, anything you can do on a particular computer platform in the Java programming language you could also do in assembly language. But it still matters which you choose.JSP provides the following benefits over servlets alone:• It is easier to write and maintain the HTML. Your static code is ordinary HTML: no extra backslashes, no double quotes, and no lurking Java syntax.• You can use standard Web-site development tools. Even HTML tools that know nothing about JSP can be used because they simply ignore the JSP tags.• You can divide up your development team. The Java programmers can work on the dynamic code. The Web developers can concentrate on the presentation layer. On large projects, this division is very important. Depending on the size of your team and the complexity of your project, you can enforce a weaker or stronger separation between the static HTML and the dynamic content.Now, this discussion is not to say that you should stop using servlets and use only JSP instead. By no means. Almost all projects will use both. For some requests in your project, you will use servlets. For others, you will use JSP. For still others, you will combine them with the MVC architecture . You want the apGFDGpropriate tool for the job, and servlets, by themselves, do not complete your toolkit.1.2 SOURCE OF JSPThe technique of JSP of the company of Sun, making the page of Webdevelop the personnel can use the HTML perhaps marking of XML to design to turn the end page with format. Use the perhaps small script future life of marking of JSP becomes the dynamic state on the page contents.( the contents changes according to the claim of)The Java Servlet is a technical foundation of JSP, and the large Web applies the development of the procedure to need the Java Servlet to match with with the JSP and then can complete, this name of Servlet comes from the Applet, the local translation method of now is a lot of, this book in order not to misconstruction, decide the direct adoption Servlet but don't do any translation, if reader would like to, can call it as" small service procedure". The Servlet is similar to traditional CGI, ISAPI, NSAPI etc. Web procedure development the function of the tool in fact, at use the Java Servlet hereafter, the customer need not use again he lowly method of CGI of efficiency, also need not use only the ability come to born page of Web of dynamic state in the method of API that a certain fixed Web server terrace circulate. Many servers of Web all support the Servlet, even not support the Servlet server of Web directly and can also pass the additional applied server and the mold pieces to support the Servlet. Receive benefit in the characteristic of the Java cross-platform, the Servlet is also a terrace irrelevant, actually, as long as match the norm of Java Servlet, the Servlet is complete to have nothing to do with terrace and is to have nothing to do with server of Web. Because the Java Servlet is internal to provide the service by the line distance, need not start a progress to the each claimses, and make use of the multi-threading mechanism can at the same time for several claim service, therefore the efficiency of Java Servlet is very high.But the Java Servlet also is not to has no weakness, similar to traditional CGI, ISAPI, the NSAPI method, the Java Servlet is to make use of to output the HTML language sentence to carry out the dynamic state web page of, if develop the whole website with the Java Servlet, the integration process of the dynamic state part and the static state pageis an evil-foreboding dream simply. For solving this kind of weakness of the Java Servlet, the SUN released the JSP.A number of years ago, Marty was invited to attend a small 20-person 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 high-level manager from a very large software company 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 company'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 company would take technology from other companies and suborn it for their own purposes. But guess what? The shoe is on the other foot here. The Java community did not invent the idea of designing pages as a mixture of static HTML and dynamic code marked with special tags. For example, Cold Fusion did it years earlier. Even ASP (a product from the very software company 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.The JSP is an establishment at the model of Java servlets on of the expression layer technique, it makes the plait write the HTML to become more simple.Be like the SSJS, it also allows you carry the static state HTML contents and servers the script mix to put together the born dynamic state exportation. JSP the script language that the Java is the tacit approval, however, be like the ASP and can use other languages( such as JavaScript and VBScript), the norm of JSP also allows to use other languages.1.3JSP CHARACTERISTICSIs a service according to the script language in some one language of the statures system this kind of discuss, the JSP should be see make is a kind of script language. However, be a kind of script language, the JSP seemed to be too strong again, almost can use all Javas in the JSP.Be a kind of according to text originally of, take manifestation as the central development technique, the JSP provided all advantages of the Java Servlet, and, when combine with a JavaBeans together, providing a kind of make contents and manifestation that simple way that logic separate. Separate the contents and advantage of logical manifestations is, the personnel who renews the page external appearance need not know the code of Java, and renew the JavaBeans personnel also need not be design the web page of expert in hand, can use to take the page of JavaBeans JSP to define the template of Web, to build up a from have the alike external appearance of the website that page constitute. JavaBeans completes the data to provide, having no code of Java in the template thus, this means that these templates can be written the personnel by a HTML plait to support. Certainly, can also make use of the Java Servlet to control the logic of the website, adjust through the Java Servlet to use the way of the document of JSP to separate website of logic and contents.Generally speaking, in actual engine of JSP, the page of JSP is the edit and translate type while carry out, not explain the type of. Explain the dynamic state web page development tool of the type, such as ASP, PHP3 etc., because speed etc. reason, have already can't satisfy current the large electronic commerce needs appliedly, traditional development techniques are all at to edit and translate the executive way change, such as the ASP → ASP+;PHP3 → PHP4.In the JSP norm book, did not request the procedure in the JSP code part( be called the Scriptlet) and must write with the Java definitely. Actually, have some engines of JSP are adoptive other script languages such as the EMAC- Script, etc., but actually this a few script languagesalso are to set up on the Java, edit and translate for the Servlet to carry out of. Write according to the norm of JSP, have no Scriptlet of relation with Java also is can of, however, mainly lie in the ability and JavaBeans, the Enterprise JavaBeanses because of the JSP strong function to work together, so even is the Scriptlet part not to use the Java, edit and translate of performance code also should is related with Java.1.4JSP MECHANISMTo comprehend the JSP how unite the technical advantage that above various speak of, come to carry out various result easily, the customer must understand the differentiation of" the module develops for the web page of the center" and" the page develops for the web page of the center" first.The SSJS and ASP are all in several year ago to release, the network of that time is still very young, no one knows to still have in addition to making all business, datas and the expression logic enter the original web page entirely heap what better solve the method. This kind of model that take page as the center studies and gets the very fast development easily. However, along with change of time, the people know that this kind of method is unwell in set up large, the Web that can upgrade applies the procedure. The expression logic write in the script environment was lock in the page, only passing to shear to slice and glue to stick then can drive heavy use. Express the logic to usually mix together with business and the data logics, when this makes be the procedure member to try to change an external appearance that applies the procedure but do not want to break with its llied business logic, apply the procedure of maintenance be like to walk the similar difficulty on the eggshell. In fact in the business enterprise, heavy use the application of the module already through very mature, no one would like to rewrite those logics for their applied procedure.HTML and sketch the designer handed over to the implement work of their design the Web plait the one who write, make they have to double work- Usually is the handicraft plait to write, becausehave no fit tool and can carry the script and the HTML contents knot to the server to put together. Chien but speech, apply the complexity of the procedure along with the Web to promote continuously, the development method that take page as the center limits sex to become to get up obviously.At the same time, the people always at look for the better method of build up the Web application procedure, the module spreads in customer's machine/ server the realm. JavaBeans and ActiveX were published the company to expand to apply the procedure developer for Java and Windows to use to come to develop the complicated procedure quickly by" the fast application procedure development"( RAD) tool. These techniques make the expert in the some realm be able to write the module for the perpendicular application plait in the skill area, but the developer can go fetch the usage directly but need not control the expertise of this realm.Be a kind of take module as the central development terrace, the JSP appeared. It with the JavaBeans and Enterprise JavaBeans( EJB) module includes the model of the business and the data logic for foundation, provide a great deal of label and a script terraces to use to come to show in the HTML page from the contents of JavaBeans creation or send a present in return. Because of the property that regards the module as the center of the JSP, it can drive Java and not the developer of Java uses equally. Not the developer of Java can pass the JSP label( Tags) to use the JavaBeans that the deluxe developer of Java establish. The developer of Java not only can establish and use the JavaBeans, but also can use the language of Java to come to control more accurately in the JSP page according to the expression logic of the first floor JavaBeans.See now how JSP is handle claim of HTTP. In basic claim model, a claim directly was send to JSP page in. The code of JSP controls to carry on hour of the logic processing and module of JavaBeanses' hand over with each other, and the manifestation result in dynamic state bornly, mixing with the HTML page of the static state HTML code. The Beans can be JavaBeansor module of EJBs. Moreover, the more complicated claim model can see make from is request other JSP pages of the page call sign or Java Servlets.The engine of JSP wants to chase the code of Java that the label of JSP, code of Java in the JSP page even all converts into the big piece together with the static state HTML contents actually. These codes piece was organized the Java Servlet that customer can not see to go to by the engine of JSP, then the Servlet edits and translate them automatically byte code of Java.Thus, the visitant that is the website requests a JSP page, under the condition of it is not knowing, an already born, the Servlet actual full general that prepared to edit and translate completes all works, very concealment but again and efficiently. The Servlet is to edit and translate of, so the code of JSP in the web page does not need when the every time requests that page is explain. The engine of JSP need to be edit and translate after Servlet the code end is modify only once, then this Servlet that editted and translate can be carry out. The in view of the fact JSP engine auto is born to edit and translate the Servlet also, need not procedure member begins to edit and translate the code, so the JSP can bring vivid sex that function and fast developments need that you are efficiently.Compared with the traditional CGI, the JSP has the equal advantage. First, on the speed, the traditional procedure of CGI needs to use the standard importation of the system to output the equipments to carry out the dynamic state web page born, but the JSP is direct is mutually the connection with server. And say for the CGI, each interview needs to add to add a progress to handle, the progress build up and destroy by burning constantly and will be a not small burden for calculator of be the server of Web. The next in order, the JSP is specialized to develop but design for the Web of, its purpose is for building up according to the Web applied procedure, included the norm and the tool of a the whole set. Use the technique of JSP can combine a lot of JSP pages to become a Web applicationprocedure very expediently.1.5 The operation principle and the advantages of JSP tagsIn this section of the operating principle of simple introduction JSP and strengths.For the first time in a JSP documents requested by the engine, JSP Servlet is transformed into a document JSP. This engine is itself a Servlet. The operating process of the JSP shown below:(1) the JSP engine put the JSP files converting a Java source files (Servlet), if you find the files have any grammar mistake JSP, conversion process will interrupt, and to the server and client output error messages.(2) if converted, with the engine JSP javac Java source file compiler into a corresponding scale-up files.(3) to create a the Servlet (JSP page), the transformation of the Servlet jspInit () method was executed, jspInit () method in the life cycle of Servlet executed only once.(4) jspService () method invocation to the client requests. For each request, JSP engine to create a new thread for processing the request. If you have multiple clients and request the JSP files, JSP engine will create multiple threads. Each client requests a thread. To execute multi-thread can greatly reduce the requirement of system resources, improving the concurrency value and response time. But also should notice the multi-thread programming, due to the limited Servlet always in response to memory, so is very fast.(5) if the file has been modified. The JSP, server will be set according to the document to decide whether to recompile, if need to recompile, will replace the Servlet compile the memory and continue the process.(6) although the JSP efficiency is high, but at first when the need to convert and compile and some slight delay. In addition, if at any time due to reasons of system resources, JSP engine will in some way ofuncertain Servlet will remove from memory. When this happens jspDestroy () method was first call.(7) and then Servlet examples were marked with "add" garbage collection. But in jspInit () some initialization work, if establish connection with database, or to establish a network connection, from a configuration file take some parameters, such as, in jspDestory () release of the corresponding resources.Based on a Java language has many other techniques JSP page dynamic characteristics, technical have embodied in the following aspects: One simplicity and effectivenessThe JSP dynamic web pages with the compilation of the static HTML pages of writing is very similar. Just in the original HTML page add JSP tags, or some of the proprietary scripting (this is not necessary). So, a familiar with HTML page write design personnel may be easily performed JSP page development. And the developers can not only, and write script by JSP tags used exclusively others have written parts to realize dynamic pages. So, an unfamiliar with the web developers scripting language, can use the JSP make beautiful dynamic pages. And this in other dynamic web development is impossible.Tow the independence of the programThe JSP are part of the family of the API Java, it has the general characteristics of the cross-platform Java program. In other words, is to have the procedure, namely the independence of the platform, 6 Write bided anywhere! .Three procedures compatibilityThe dynamic content can various JSP form, so it can show for all kinds of customers, namely from using HTML/DHTML browser to use various handheld wireless equipment WML (for example, mobile phones and pdas), personal digital equipment to use XML applications, all can use B2B JSP dynamic pages.Four program reusabilityIn the JSP page can not directly, but embedded scripting dynamic interaction will be cited as a component part. So, once such a component to write, it can be repeated several procedures, the program of the reusability. Now, a lot of standard JavaBeans library is a good example.JSP的技术发展历史作者: Kathy Sierra and Bert Bates来源: Servlet&JSPJava Server Pages(JSP)是一种基于web的脚本编程技术,类似于网景公司的服务器端Java脚本语言——server-side JavaScript(SSJS)和微软的Active Server Pages(ASP).与SSJS和ASP相比,JSP具有更好的可扩展性,并且它不专属于任何一家厂商或某一特定的Web服务器。

Servlet和JSP技术简述中英文对照外文翻译文献

Servlet和JSP技术简述中英文对照外文翻译文献

中英文资料对照外文翻译An Overview of Servlet and JSP Technology 1.1 A Servlet's JobServlets are Java programs that run on Web or application servers, acting as a middle layer between requests coming from Web browsers or other HTTP clients and databases or applications on the HTTP server. Their job is to perform the following tasks, as illustrated in Figure 1-1.Figure 1-11.Read the explicit data sent by the client.The end user normally enters this data in an HTML form on a Web page. However, the data could also come from an applet or a custom HTTP client program.2.Read the implicit HTTP request data sent by the browser.Figure 1-1 shows a single arrow going from the client to the Web server (the layer where servlets and JSP execute), but there are really two varieties of data: the explicit data that the end user enters in a form and the behind-the-scenes HTTP information. Both varieties are critical. The HTTP information includes cookies, information about media types and compression schemes the browser understands, and so on. 3.Generate the results.This process may require talking to a database, executing an RMI or EJB call, invoking a Web service, or computing the response directly. Your real data may be ina relational database. Fine. But your database probably doesn't speak HTTP or return results in HTML, so the Web browser can't talk directly to the database. Even if it could, for security reasons, you probably would not want it to. The same argument applies to most other applications. You need the Web middle layer to extract the incoming data from the HTTP stream, talk to the application, and embed the results inside a document.4.Send the explicit data (i.e., the document) to the client.This document can be sent in a variety of formats, including text (HTML or XML), binary (GIF images), or even a compressed format like gzip that is layered on top of some other underlying format. But, HTML is by far the most common format, so an important servlet/JSP task is to wrap the results inside of HTML.5.Send the implicit HTTP response data.Figure 1-1 shows a single arrow going from the Web middle layer (the servlet or JSP page) to the client. But, there are really two varieties of data sent: the document itself and the behind-the-scenes HTTP information. Again, both varieties are critical to effective development. Sending HTTP response data involves telling the browser or other client what type of document is being returned (e.g., HTML), setting cookies and caching parameters, and other such tasks.1.2 Why Build Web Pages Dynamically?many client requests can be satisfied by prebuilt documents, and the server would handle these requests without invoking servlets. In many cases, however, a static result is not sufficient, and a page needs to be generated for each request. There are a number of reasons why Web pages need to be built on-the-fly:1.The Web page is based on data sent by the client.For instance, the results page from search engines and order-confirmation pages at online stores are specific to particular user requests. You don't know what to display until you read the data that the user submits. Just remember that the user submits two kinds of data: explicit (i.e., HTML form data) and implicit (i.e., HTTP requestheaders). Either kind of input can be used to build the output page. In particular, it is quite common to build a user-specific page based on a cookie value.2.The Web page is derived from data that changes frequently.If the page changes for every request, then you certainly need to build the response at request time. If it changes only periodically, however, you could do it two ways: you could periodically build a new Web page on the server (independently of client requests), or you could wait and only build the page when the user requests it. The right approach depends on the situation, but sometimes it is more convenient to do the latter: wait for the user request. For example, a weather report or news headlines site might build the pages dynamically, perhaps returning a previously built page if that page is still up to date.3.The Web page uses information from corporate databases or other server-side sources.If the information is in a database, you need server-side processing even if the client is using dynamic Web content such as an applet. Imagine using an applet by itself for a search engine site:"Downloading 50 terabyte applet, please wait!" Obviously, that is silly; you need to talk to the database. Going from the client to the Web tier to the database (a three-tier approach) instead of from an applet directly to a database (a two-tier approach) provides increased flexibility and security with little or no performance penalty. After all, the database call is usually the rate-limiting step, so going through the Web server does not slow things down. In fact, a three-tier approach is often faster because the middle tier can perform caching and connection pooling.In principle, servlets are not restricted to Web or application servers that handle HTTP requests but can be used for other types of servers as well. For example, servlets could be embedded in FTP or mail servers to extend their functionality. And, a servlet API for SIP (Session Initiation Protocol) servers was recently standardized (see /en/jsr/detail?id=116). In practice, however, this use of servlets has not caught on, and we'll only be discussing HTTP servlets.1.3 The Advantages of Servlets Over "Traditional" CGIJava servlets are more efficient, easier to use, more powerful, more portable, safer, and cheaper than traditional CGI and many alternative CGI-like technologies. 1.EfficientWith traditional CGI, a new process is started for each HTTP request. If the CGI program itself is relatively short, the overhead of starting the process can dominate the execution time. With servlets, the Java virtual machine stays running and handles each request with a lightweight Java thread, not a heavyweight operating system process. Similarly, in traditional CGI, if there are N requests to the same CGI program, the code for the CGI program is loaded into memory N times. With servlets, however, there would be N threads, but only a single copy of the servlet class would be loaded. This approach reduces server memory requirements and saves time by instantiating fewer objects. Finally, when a CGI program finishes handling a request, the program terminates. This approach makes it difficult to cache computations, keep database connections open, and perform other optimizations that rely on persistent data. Servlets, however, remain in memory even after they complete a response, so it is straightforward to store arbitrarily complex data between client requests. 2.ConvenientServlets have an extensive infrastructure for automatically parsing and decoding HTML form data, reading and setting HTTP headers, handling cookies, tracking sessions, and many other such high-level utilities. In CGI, you have to do much of this yourself. Besides, if you already know the Java programming language, why learn Perl too? You're already convinced that Java technology makes for more reliable and reusable code than does Visual Basic, VBScript, or C++. Why go back to those languages for server-side programming?3.PowerfulServlets support several capabilities that are difficult or impossible to accomplish with regular CGI. Servlets can talk directly to the Web server, whereas regular CGI programs cannot, at least not without using a server-specific API. Communicatingwith the Web server makes it easier to translate relative URLs into concrete path names, for instance. Multiple servlets can also share data, making it easy to implement database connection pooling and similar resource-sharing optimizations. Servlets can also maintain information from request to request, simplifying techniques like session tracking and caching of previous computations.4.PortableServlets are written in the Java programming language and follow a standard API. Servlets are supported directly or by a plugin on virtually every major Web server. Consequently, servlets written for, say, Macromedia JRun can run virtually unchanged on Apache Tomcat, Microsoft Internet Information Server (with a separate plugin), IBM WebSphere, iPlanet Enterprise Server, Oracle9i AS, or StarNine WebStar. They are part of the Java 2 Platform, Enterprise Edition, so industry support for servlets is becoming even more pervasive.5.InexpensiveA number of free or very inexpensive Web servers are good for development use or deployment of low- or medium-volume Web sites. Thus, with servlets and JSP you can start with a free or inexpensive server and migrate to more expensive servers with high-performance capabilities or advanced administration utilities only after your project meets initial success. This is in contrast to many of the other CGI alternatives, which require a significant initial investment for the purchase of a proprietary package.Price and portability are somewhat connected. For example, Marty tries to keep track of the countries of readers that send him questions by email. India was near the top of the list, probably #2 behind the U.S. Marty also taught one of his JSP and servlet training courses (see /) in Manila, and there was great interest in servlet and JSP technology there.Now, why are India and the Philippines both so interested? We surmise that the answer is twofold. First, both countries have large pools of well-educated software developers. Second, both countries have (or had, at that time) highly unfavorable currency exchange rates against the U.S. dollar. So, buying a special-purpose Webserver from a U.S. company consumed a large part of early project funds.But, with servlets and JSP, they could start with a free server: Apache Tomcat (either standalone, embedded in the regular Apache Web server, or embedded in Microsoft IIS). Once the project starts to become successful, they could move to a server like Caucho Resin that had higher performance and easier administration but that is not free. But none of their servlets or JSP pages have to be rewritten. If their project becomes even larger, they might want to move to a distributed (clustered) environment. No problem: they could move to Macromedia JRun Professional, which supports distributed applications (Web farms). Again, none of their servlets or JSP pages have to be rewritten. If the project becomes quite large and complex, they might want to use Enterprise JavaBeans (EJB) to encapsulate their business logic. So, they might switch to BEA WebLogic or Oracle9i AS. Again, none of their servlets or JSP pages have to be rewritten. Finally, if their project becomes even bigger, they might move it off of their Linux box and onto an IBM mainframe running IBM WebSphere. But once again, none of their servlets or JSP pages have to be rewritten.6.SecureOne of the main sources of vulnerabilities in traditional CGI stems from the fact that the programs are often executed by general-purpose operating system shells. So, the CGI programmer must be careful to filter out characters such as backquotes and semicolons that are treated specially by the shell. Implementing this precaution is harder than one might think, and weaknesses stemming from this problem are constantly being uncovered in widely used CGI libraries.A second source of problems is the fact that some CGI programs are processed by languages that do not automatically check array or string bounds. For example, in C and C++ it is perfectly legal to allocate a 100-element array and then write into the 999th "element," which is really some random part of program memory. So, programmers who forget to perform this check open up their system to deliberate or accidental buffer overflow attacks.Servlets suffer from neither of these problems. Even if a servlet executes a system call (e.g., with Runtime.exec or JNI) to invoke a program on the local operatingsystem, it does not use a shell to do so. And, of course, array bounds checking and other memory protection features are a central part of the Java programming language.谢谢海南社区支持:/7.MainstreamThere are a lot of good technologies out there. But if vendors don't support them and developers don't know how to use them, what good are they? Servlet and JSP technology is supported by servers from Apache, Oracle, IBM, Sybase, BEA, Macromedia, Caucho, Sun/iPlanet, New Atlanta, ATG, Fujitsu, Lutris, Silverstream, the World Wide Web Consortium (W3C), and many others. Several low-cost plugins add support to Microsoft IIS and Zeus as well. They run on Windows, Unix/Linux, MacOS, VMS, and IBM mainframe operating systems. They are the single most popular application of the Java programming language. They are arguably the most popular choice for developing medium to large Web applications. They are used by the airline industry (most United Airlines and Delta Airlines Web sites), e-commerce (), online banking (First USA Bank, Banco Popular de Puerto Rico), Web search engines/portals (), large financial sites (American Century Investments), and hundreds of other sites that you visit every day.Of course, popularity alone is no proof of good technology. Numerous counter-examples abound. But our point is that you are not experimenting with a new and unproven technology when you work with server-side Java.Servlet和JSP技术简述1.1 Servlet的功能Servlets是运行在Web或应用服务器上的Java程序,它是一个中间层,负责连接来自Web浏览器或其他HTTP客户程序的请求和HTTP服务器上的数据库或应用程序。

JSP技术外文翻译

JSP技术外文翻译

JSP Technology(外文原文)JSP (JavaServer Pages) is a kind of based on Java script technology. In many of the advantages of JSP, one of which is it can the HTML code from Web pages in the business logic of the effectively separated. With JSP visit reusable components, such as Servlet, JavaBean and based on Java Web applications. JSP also support in Web page direct embedded Java code. The two methods can visit JSP files: browser to send files request, sent to the JSP Servlet request.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.The Unified Expression Language (EL)The simple EL included in JSP technology offers many advantages to the page author. Using simple expressions, page authors can easily access external data objects from their pages. The JSP technology container evaluates and resolves these expressions as it encounters them. It then immediately returns a response because the JSP request-processing model has only one phase, the render phase. However, because therequest-processing model does not support a postback, all JSP expressions are read-only.Unlike JSP technology, JavaServer Faces technology supports a multiphase life cycle. When a user enters values into the JavaServer Faces UI components and submits the page, those values are converted, validated, and propagated to server-side data objects, after which component events are processed. In order to perform all these tasks in an orderly fashion, the JavaServer Faces life cycle is split into separate phases. Therefore, JavaServer Faces technology evaluates expressions at different phases of the life cycle rather than immediately, as JSP technology would do.JSP technology -- friend or foe?Presentation technology was designed to transform plain ol' raw Web content into content wrapped in an attractive presentation layer. JavaServer Pages (JSP) technology, Sun's presentation model and part of the J2EE platform, has received significant attention. There are both advantages and disadvantages to using JSP technology, and Web developers should be aware of the good and the bad -- and know that they don't have to be limited to this single technology. In fact, these days a number of presentation technologies are available. This article begins by defining the problems presentation technologies were designed to solve. It then examines the specific strengths and weaknesses of the JSP model. Finally, it introduces some viable alternatives to Sun's presentation technology.A bit of historyBefore diving into an explanation of presentation technology, it's helpful to fill in some details on the situation that led to the birth of the technology. Just 10 short years ago, the term thin client was a novelty. We still lived in a world of desktop applications, powered by wimpy 286 microprocessors with 14-inch monitors that we squinted at. Boy, have times changed! Now my desktop does nothing but powera Web browser, while servers from Sun, IBM, HP, Compaq, and the rest churn out computations, business logic, and content. And that little monitor? Replaced by flat-screen, plasma, whopping 21- and 25-inch beauties. Why? So we can see the intricate and complex HTML displays that serve as a front-end to these powerful applications. No longer does a clunky interface suffice; now we expect flashy graphics, moving images, color-coordinated presentations that would look good in any room in the house, and speedy rendering to boot.The premiseToday, a decade beyond those fledgling Windows applications, we are still dealing with this huge shift in the presentation paradigm. The woeful Visual Basic and C programmers who remain now find themselves working either on back-end systems or Windows-only applications, or they have added a Web-capable language such as the Java language to their toolbox. An application that doesn't support at least three of four ML-isms -- such as HTML, XML, and WML -- is considered shabby, if not an outright failure. And, of course, that means we all care very deeply about the ability to easily develop a Web presentation it turns out, using the new Internet, and all the languages we have at our disposal -- Java, C, Perl, Pascal, and Ada, among others -- hasn't been as easy as we might have hoped. A number of issues creep up when it comes to taking the programming languages everyone used for back-end systems and leveraging them to generate markup language suitable for a client. With the arrival of more options on the browser (DHTML and JavaScript coding, for example), the increase in graphic artist talent in the Web domain, and tools that could create complex interfaces using standard HTML, the demand for fancy user interfaces has grown faster than our ability to develop these front ends to our applications. And this has given rise to presentation technology was designed to perform a single task: convert content, namely data without display details, intopresentation -- meaning the various user interfaces you see on your phone, PalmPilot, or Web browser. What are the problems that these presentation technologies claimed to solve? Let's take a look.Segregation vs. integrationThe primary purpose of presentation technology is to allow a separation between content and presentation. In other words, business logic units (presumably in some programming language like C or Java) don't have to generate data in a presentation-specific manner. Data, or content, is returned raw, without formatting. The presentation technology then applies formatting, or presentation, to this content. The result is an amalgam of data surrounded by and intertwined with graphics, formatting, colors, and at the examples in Listing 1 and Listing 2 to see at a glance the difference between raw content and content combined with presentation 1 shows raw content, with nothing but data, that could be used in a variety of ways.class=displaycodeRussell CroweTom HanksMeg RyanMary Stuart MastersonAlec BaldwinAshley JuddKeanu ReevesListing 2, which is much more complex than the one above, shows the same data wrapped in presentation technology and ready for display in an HTML-capable browser.class=displaycode<HTML><HEAD><TITLE>Search Results: Actors</TITLE></HEAD><BODY><H2 ALIGN="center">Search Results: Actors</H2><CENTER><HR width="85%"><TABLE width="50%" CELLPADDING="3" CELLSPACING="3" border="1" BGCOLOR="#FFFFCC"><TR BGCOLOR="#FFCCCC"><TH width="50%" ALIGN="center">Last Name</TH><TH width="50%" ALIGN="center">First Name</TH></TR><TR><TD width="50%">Baldwin</TD><TD width="50%">Alec</TD></TR><TR><TD width="50%">Crowe</TD><TD width="50%">Russell</TD></TR><TR><TD width="50%">Hanks</TD><TD width="50%">Tom</TD></TR><TR><TD width="50%">Judd</TD><TD width="50%">Ashley</TD></TR><TR><TD width="50%">Masterson</TD><TD width="50%">Mary Stuart</TD></TR><TR><TD width="50%">Reeves</TD><TD width="50%">Keanu</TD></TR><TR><TD width="50%">Ryan</TD><TD width="50%">Meg</TD></TR></TABLE></CENTER>While the content in Listing 1 is clear and easy for the uninitiated layperson to both use and understand, the content in Listing 2 is very specific to the task of display in a browser. It is tricky to extract data from it or manipulate it for any other fundamental difference, the process of segregating content from presentation instead of integrating the two (at least until the user needs the information), is the basic premise of any presentation technology, including the JSP technology. Further, any presentation technology that does not accomplish this basic goal does not truly accomplish the goal it was created to achieve.Work vs. reworkBesides the separation of content and presentation, another measure of a presentation technology's usefulness is the amount of rework that it eliminates. The divergence of presentation and content enforces a divergence in the roles of those developing the content. A programmer can focus on the raw content presented in the examples above, and a graphic artist or webmaster can attend to the presentation. A slight overlap ofroles remains, however, in the process of taking the presentation -- or markup -- designed by the artist and applying it to the content the programmer's code the simplest case, the artist supplies the markup, and the developer provides code and also plugs the markup into the presentation technology. The application is "started up," and the content magically becomes a user interface. Of course, as we all know, development rarely ends there. Next come revisions and changes to the interface and new business rules that must be coded. This is where the true test of the presentation technology's flexibility comes into play. While it is usually simple to update the raw content being fed into the presentation layer, rarely can the graphic artists easily edit their original work. Changes to the presentation layer are common (we've all been victim to marketing departments changing this or that). So now a problem arises: what do the designers change to tweak their work? The original markup language page they gave to the developer? Probably not, as that page has most likely had custom tags or code inserted (JSP pages, template engines), converted to a Java servlet, or changed into something totally the designer must rework the original page and resubmit this page to the developer. Then the developer has to reconvert this page to the specific format needed for use in the presentation technology. Alternatively, the designer has to learn a scripting language or at least know that which areas of the page's source code from the developer are off limits. Of course, this is an error-prone, dangerous way to operate. Once you've determined that a presentation technology allows a clean split between content and presentation, you should try to ensure that a minimum amount of rework is necessary in order to make presentation changes.The promise of JSP technologyNow, on to the specifics of JSP coding. The promise of JSP technologyis to supply the designer and developer the only presentation technology they will ever need. JSP technology is part of the J2EE platform, which is the strongest show of support Sun can give one of its Java products. To give you an idea of how prevalent this solution is, try running a search on 'JSP' at ; you'll find more books devoted to JSP technology than about almost any other single Java API. Before I dive into the specific problems that JSP technology presents, you need a clear understanding of what it claims to do.Content vs. presentationAbove all, JSP technology is about separating content from presentation, foremost in Sun's published set of goals for JSP pages. In fact, JSP design stemmed directly from the complaints of developers who were tired of typing ("<HTML><HEAD><TITLE>" + () + "</TITLE></HEAD>"); into their servlet code. This mixing of hard-coded content with runtime variables presented a horrible burden on servlet developers. It also made making even minor changes to the presentation layer difficult for the technology addresses this situation by allowing normal HTML pages (and later, WML or other markup language pages) to be compiled at runtime into a Java servlet, essentially mimicking the () paradigm, without requiring the developer to write this code. And it allows you to insert variables into the page that are not interpreted until a JSP page the HTML snippet shown in could look like the example in Listing 3.class=displaycode<%@ page import="" %><%@ page import="" %><%PageInfo pageInfo = (PageInfo)("PAGE_DATA")%><HTML><HEAD><TITLE><%=()%></TITLE></HEAD><BODY><!-- Other HTML content --></BODY></HTML>Judging by these initial principles, then, JSP technology (at least in its stated design) would satisfy the first tenet of a presentation technology, as outlined above: that content be separated from presentation.Code vs. markupSecond on the JSP technology's list of features is something that might raise a bit of concern. JSP coding lets you insert Java code directly into a page of markup. To understand why this decision was made, recall that when the JSP specification was being developed, Sun's competition from Microsoft was at an all-time high, primarily due to the success of Microsoft Active Server Pages (ASP). The similarity of the name JavaServer Pages to Active Server Pages was not merely coincidental. And the ability to mimic many of ASP's features was also intentional. So JSP authors were given the option to add Java code into their an example of Java code being added to markup, the JSP snippet in Listing 4 dynamically adds rows as needed to show each item in the Vector of actors.class=displaycode<%@ page import="" %><%@ page import="" %><%@ page import="" %><%@ page import="" %><%@ page import="" %><%PageInfo pageInfo = (PageInfo)("PAGE_DATA")Vector actors = ()%><HTML><HEAD><TITLE><%=()%></TITLE></HEAD><BODY><H2 ALIGN="center">Search Results: Actors</H2><CENTER><HR width="85%"><TABLE width="50%" CELLPADDING="3" CELLSPACING="3" border="1" BGCOLOR="#FFFFCC"><%for (Iterator i = (); ()) {Actor actor = (Actor)();%><TR BGCOLOR="#FFCCCC"><TH width="50%" ALIGN="center"><%=()%></TH><TH width="50%" ALIGN="center"><%=()%></TH></TR><%}%></TABLE></CENTER></BODY></HTML>Remember that so far I am simply describing the initial design goals of JSP technology; I'll defer my own judgment about the goals until a later section about the problems of JSP technology. You might be a little suspicious already, however, since embedding code into a JSP page would seem to cause problems with the first goal of JSP technology, separating content from presentation. But really (ahem), I'm not editorializing yet.Designer vs. developerA final (and admirable) goal of JSP technology worth mentioning is that it seeks to establish clearly defined roles in the application development process. By ostensibly breaking content from presentation, JSP technology creates a clearer distinction between the designer and developer. The designer creates markup, using only standard HTML, WML, or whatever language is appropriate, and the developer writes code. Of course, many designers today have learned JavaScript, so it should come as no surprise that many of these same designers have begun to learn JSP coding. Often, instead of just doing pure markup, they encode a complete JSP page and hand it over to the developer. Then the usual tweaking takes place, and the developer puts the JSP page into place as a front-end for some portion of the overall application. The key, though, is that manydesigners do not learn JSP coding, so it must also be workable in that environment.The problemsI've spelled out what a good presentation technology should provide, as well as the specific problems that JSP technology seeks to address. Now, I'm ready to cut to the chase: JSP technology, while built on good ideas, presents quite a few problems. Before you choose to use JSP coding in your applications (which you might still do), you should at least be aware of possible should also be aware of a facet of the J2EE programming platform that is often ignored: just because an API comes with the platform doesn't mean you have to use it. As silly as this sounds, many developers are struggling with the JSP, or EJB, or JMS APIs, thinking if they don't use these APIs, their applications somehow won't really be "J2EE applications." In fact, the platform boasts more APIs than most applications need. If you have problems with or doubts about JSP technology, you don't have to use it! Take a close look at both the positives and the negatives before choosing to use JSP technology in your applications. Let's take a look at some of the vs. language lock-inJSP technology locks you into a specific language. This point shouldn't be given too much weight. Java technology for enterprise applications (in my opinion, at least) is the only language choice. And there are no language-independent solutions in this space anyway. Of course, at this stage of the game, I'm disregarding the Microsoft .NET platform for the smoke and mirrors it is. Only time will tell whether that platform will develop into one that is truly language-independent. (I'm more than a bit dubious.)Still, choosing JSP technology forces you to use the Java language, at least for presentation and content. While CORBA can be used for business logic, JSP coding does necessitate some familiarity with servlets as well as the core Java language. Since many developers come to JSP coding through the J2EE platform, this doesn't usually present avs. independenceThroughout this article, I've come back to the idea of separating content from presentation. You're probably pretty sick of hearing about this, so now's the time to determine whether or not JSP actually accomplishes this goal. As I've already discussed, JSP claims to have been designed for this separation purpose, and therefore we should assume it achieves its objectives, right? Not the line between content and presentationJSP allows Java code to be inserted into the markup language page, and this rather dangerous feature allows content to be intermingled with presentation. Even worse, business logic often makes its way into JSP pages, as shown in Listing 5.class=displaycode<%@ page import="" %><%@ page import="" %><%@ page import="" %><%@ page import="" %><%@ page import="" %><%@ page import="" %><%PageInfo pageInfo = (PageInfo)("PAGE_DATA")%><HTML><HEAD><TITLE><%=()%></TITLE></HEAD><BODY><H2 ALIGN="center">Search Results: Actors</H2><CENTER><HR width="85%"><TABLE width="50%" CELLPADDING="3" CELLSPACING="3" border="1"BGCOLOR="#FFFFCC"><%asPermission("ADMINISTRATOR")) {actors = ());} else {actors = ();}for (Iterator i = (); ()) {Actor actor = (Actor)();%><TR BGCOLOR="#FFCCCC"><TH width="50%" ALIGN="center"><%=()%></TH><TH width="50%" ALIGN="center"><%=()%></TH></TR><%}%></TABLE></CENTER></BODY></HTML>JSP advocates are quick to let you know that JSP tag libraries can help you avoid this problem. Tag libraries allow custom tags (for example, <AUTHORS />) to be added to a JSP page, which at runtime are resolved intocode fragments in, well, tag use of a custom tag and associated tag library would allow the example above to be converted to that shown in Listing 6.class=displaycode<CENTER><TABLE width="50%" CELLPADDING="3" CELLSPACING="3" border="1"BGCOLOR="#FFFFCC"><ACTORS /></TABLE></CENTER>At runtime, the code for this tag executes and the correct results are inserted into the page. But this does not solve the problem. The argument against JSP technology is not whether content and presentation can be separated, but whether they must be separated. As long as JSP coding allows inline coding, it is very convenient (especially when deadlines are looming) to make last-minute changes with inline code, rather than converting the code to a tag library. If this doesn't ring true, consider why the Java language immediately gained popularity over C and C++: Java disallowed many of the features that were problematic in C, such as pointer addition. While you can always argue that you don't have to perform pointer addition in C or that no good programmer would ever insert code scriptlets, we all know what happens in practice. The Java language is a better language because it mandates that these sorts of bad habits never surface. But JSP in this case is much like C, allowing some very bad additional litmus test of the JSP technology's success in meeting its stated objectives is to see whether or not it is possible to achieve this goal in practice; certainly it isn't fair to hold JSP to an impossible standard. Most template engines, like FreeMarker and WebMacro, have this same inline coding facility, often with a Perl-analogue language. However, technologies like Enhydra's XMLC do not allow this type of inline coding.Instead, these technologies take a pure markup language page as input, and generate Java methods. This essentially is changing the program flow; instead of the page (JSP technology) calling logic from the application, the application (Enhydra) uses methods to affect the values of the page. In the specific case of Enhydra, XMLC converts the page into a DOM tree, and uses the DOM's HTML binding to allow "fields" in the page to be updated. The point here is that more so than XMLC, JSP technology can achieve its goals, by only allowing tag libraries, for example. But the general tendency in Sun specifications is to always maintain backward compatibility, or at least maintain it for quite a long time. The current version of the JSP spec, , allows scriptlets, so expect to see code allowed in JSP pages for several years to come. Before diving into JSP coding, be careful of the rather large hole that lies between its ideal, a complete separation of content and presentation, and what it actually provides, which is at best a pseudo-split between your user interface and the code that drives your application.Single-processing vs. multi-taskingIdeally, as discussed above, a designer ought to be able to perform a single process, working purely on graphic design, and a developer should be able to focus purely on coding. So the designer should be able to work on a page after it has been converted to an application-suitable format. In the case of a JSP page, that would be after JavaBeans have been imported, inline coding has been inserted, and custom tag libraries have been added to the page. The problem is that some designers use HTML editors, such as HoTMetaL, Macromedia Dreamweaver, or FrontPage, that do not recognize code scriptlets or tag libraries, which means the designer effectively receives only a partial page. Imagine the difficulties when tag libraries or code fragments generate rows of a table, or other formatting detailsfor the page. Designers using the incompatible HTML editors can't see what those elements look like. When designers can't easily revise pages after developers finish coding them, instead of clarifying distinct roles, JSP coding can cause them to merge: a developer must multitask, becoming developer, designer, and about the importance of this feature? Then download the J2EE Reference Implementation and load one of the included JSP pages into a WYSIWYG HTML editor, such as Dreamweaver. The page immediately fills with yellow areas letting you know about all the "illegal" markup contained within the page. Of course, the yellow results from the JSP tags and code, rather than any real error in the date, no JSP-capable WYSIWYG editors exist, and I have not heard of any efforts to build one. While template engines have this same problem, many Java-based solutions, such as my favorite, Enhydra, allow you to supply the markup page as input to the presentation technology. In this case, the designer can make changes as often as needed and resupply the markup page. Running the engine or compiler for the presentation technology converts it to the proper format, and no code changes have to be made (in the typical case). The result is the desired one: designers remain designers, and developers remain , be wary of the promise of JSP technology as compared to the reality of what it delivers. In practice, to function in a JSP technology-driven environment you must either have your developers handle a large portion of the markup or have designers learn at least some JSP vs. XMLOne of the most significant disadvantages of JSP technology, and one of the most overlooked, is its incompatibility with XML. More precisely, and particularly in the HTML realm, JSP pages are not required to be XHTML-compatible. XHTML is a World Wide Web Consortium (W3C) specification that is now replacing HTML . XHTML defines the HTML tagset in terms of a well-formed XML document. For example, the <br> tag must be converted to <br/> to ensure XML compliance. Similar rulesare applied to image tags, and in XHTML (recently coming of age) most font properties and other styling move into CSS stylesheets. Still, most standard HTML documents convert easily to XHTML , which means they can be read directly with any XML-compliant parser, such as Apache Xerces, and manipulated as XML."What's the big deal?" you ask. The big deal is that XML quickly is becoming the global standard for inter- and intra-application communication. Passing data around in an XML format lets any other application that employs basic XML data-handling facilities use your application's data easily. Imagine being able to communicate with credit card companies for e-commerce simply by moving your data into an XML format! Many times, your presentation of data needs to be exchanged with other companies as well. The most common case is the portal application, which receives content from a variety of providers (weather, stock quotes, and news, for example), often with branding from the provider. JSP pages, however, with their mix of code and custom tag libraries, cannot function well in this pages are rarely well-formed XML documents, never mind conforming to XHTML, a markup language that doesn't allow the various JSP custom tag libraries. More important, though, is that the code snippets inserted in JSP pages are not any form of markup and will create loads of parser errors once they are processed by another you go quoting me on this, let's get the whole story out there. If the application were to allow the JSP page to be evaluated by the original client, the result would be pure HTML (or WML, VoXML, and so on). Most applications that request this data, however, employ some form of caching, as network round-trips are very expensive. In these cases, the cached page returns stale data. In those cases, then, you'd probably prefer to return pure XML-compliant results, preferably in a static form. And it is in those cases that JSP technology cannot help; JSP pages must always be evaluated at runtime to remove the JSP code scriptlets and tag the litmus test:。

外文翻译--JSP及其WEB技术

外文翻译--JSP及其WEB技术

外文翻译原文及译文学院计算机学院专业计算机科学与技术班级学号姓名指导教师负责教师JSP and WEB technolog1 JSP IntroductionJSP (JavaServer Pages) is a Java-based scripting technology. Is advocated by Sun Microsystems Inc., together with a number of companies involved in the establishment of a dynamic web page technology standards. JSP technology is somewhat similar to ASP technology, It is a traditional HTML page file (*. htm, *. html) to insert Java program segment (Scriptlet) and JSP tag (tag), To form the JSP file(*jsp). Web development with JSP is a cross-platform applications that can run under Linux, but also in other operating systems. In the JSP of the many advantages, one of which is that it will be HTML encoded Web page from the business logic separated effectively. JSP access with reusable components, such as Servlet, JavaBean and Java-based Web applications. JSP also supports directly in the Web page embedded Java code. JSP can be used two ways to access documents: JSP documents sent by the browser request, the request sent to the Servlet. JSP technology uses Java programming language, XML-type tags and scriptlets, to have a package deal with the logic of dynamic pages. Page tags and scriptlets can also exist in the server access to the resources of the application logic. JSP logic and Web page design and display isolated and support reusable component-based design, Web-based applications more quickly and easily developed.The Web server when meets visits the JSP homepage the request, first carries out segment, will then carry out the result code to return together with JSP in the document HTML for the customer. The insertion Java segment may operate the database, again the directional homepage and so on, realizes the function which the establishment dynamic homepage needs. JSP and Java Servlet are the same, is in the server end execution, usually returns to this client side is a HTML text, therefore client side, so long as has the browser to be able to glance over.The JSP page is composed of the HTML code and the inserting Java code. The server in the page by the client side was requested that later will carry on processing to these Java code, will then produce the HTML page will return gives the client side the browser. Java Servlet is the JSP technology base, moreover the large-scale Web applicationprocedure's development needs Java Servlet and the JSP coordination can complete. JSP had the Java technology simply easy to use, complete object-oriented, had the platform independency, and safe reliable, mainly faced Internet's all characteristics.2 JSP computing techniqueTo carry on the dynamic website conveniently fast the development, JSP has made the improvement in the following several aspects, causes it to become builds the cross platform fast the dynamic website first choice plan.2.1 carries on the content production and the demonstration separatesWith the JSP technology, the Web page development personnel may use HTML or the XML marking design and the formatted final page, and uses the JSP marking or the tootsy produces on page's dynamic content originally. Production content's logic is sealed in marks and in the JavaBeans module, and ties up in the script, all scripts in server end movement. Because core logic is sealed in marks and in JavaBeans, therefore the Web administrative personnels and the page designer, can edit and use the JSP page, but does not affect the content the production. In the server end, the JSP engine explained that the JSP marking and the script, produce the content which requested, and (or XML) page's form transmits the result by HTML the browser. This both are helpful in the author protects own code, and can guarantee any based on the HTML Web browser's complete usability.2.2 may entrust with heavy responsibility the moduleThe overwhelming majority JSP page relies on may entrust with heavy responsibility, the cross platform module (JavaBeans or Enterprise the JavaBeans module) carries out complex processing which the application procedure requests. The development personnel can share and exchange the execution ordinary operation the module, or causes these modules uses for more users and the customer association. Has accelerated the overall development process based on module's method, and causes each kind of organization obtains balanced in their existing skill and in the optimized result development endeavor.2.3 uses markingThe Web page development personnel will not be the familiar script language programmers. The JSP technology has sealed many functions, these functions are easy touse, marking to carry on the dynamic content production with JSP in the related XML to need. The standard JSP marking can visit and the instantiation JavaBeans module, the establishment or the retrieval module attribute, downloads Applet, as well as the execution difficulty with codes and the time-consuming function with other methods.2.4 adapts the platformNearly all platforms support Java, JSP+JavaBeans to be possible to pass unimpeded nearly under all platforms. Transplants from a platform to other platform, JSP and JavaBeans does not even need to translate, because the Java byte code is standard has nothing to do with the platform.2.5 database connectionIn Java connects the database the technology is the JDBC, Java procedure is connected through the JDBC driver and the database, operations and so on execution inquiry, extraction data. Sun Corporation has also developed JDBC-ODBC bridge, uses this technical Java procedure to be possible to visit has the ODBC driver database, at present the majority database systems have the ODBC driver, therefore the Java procedure can visit such as Oracle, Sybase, MS SQL Server and databases and so on MS Access. In addition, through the development marking storehouse, the JSP technology may further expand. The third party development personnel and other personnel may found their marking storehouse for the commonly used function. This enables the Web page development personnel to be able to use the familiar tool and to be similar to marking same carries out the specific function component to carry on the work. The JSP technology very easy conformity to many kinds of application architecture, to use the extant tool and the skill, and can expand to the support enterprise distributional application.3 Eclipse function synopsisMore and more Java development personnel already started the productivity which and the quality income appreciates Eclipse JDT to provide. It was the Java editor provides grammar Gao Liang to demonstrate that the formatting, the fold, the content were auxiliary, code template and so on many functions. It grows unceasingly available restructuring and the code generation function set permits you in a higher rank the operation code, and automated usual code intensity duty and easy wrong duty. Moreover, in develops the codeand uses JDT to compile and to carry out the JUnit test built-in support carries on the unit testing after the code, may use Eclipse the first-class Java debugger debugging when the movement meets any question. Besides JDT, Eclipse SDK- the most popular downloading - also contains Plug-in Development Environment(PDE). PDE used the specific function to expand JDT to construct the Eclipse plug-in unit - based on the Eclipse application procedure basic construction agglomeration. In fact, uses the tool which provides by Eclipse itself to be able to surmount the Java development, may expand the existing Eclipse application procedure, or even founds the brand-new application procedure.Eclipse by a script level constitution, contains in many functional modules or the Eclipse terminology so-called “the plug-in unit”. The plug-in unit is provides all functions in the Eclipse application procedure the module. They cooperate through its API to pay the final outcome together. In Eclipse, even the most foundation's function, for instance the search and the start installment's plug-in unit, seals in the plug-in unit. In order to expand the existing Eclipse function or carry on the construction in above, the plug-in unit the concrete expansion contribution for the expansion spot which will expose by other plug-in units. Usually, the plug-in unit concentrates the specific region responsibility, and gives through or a many expansion way other responsibility designation other plug-in units. For example, a plug-in unit allows you parallel to compare two documents visibly the contents, but it will not care how to read these documents even how to explain these document structure; This is other plug-in unit's work. When compared with two documents, this plug-in unit first inspects whether to have another plug-in unit to be possible to explain these document structure. If found one, it to the plug-in unit inquiry related file organization information which found, and used this information in the comparison process.May see that the modular construction was Eclipse has provided the huge flexibility, and provided one to be possible to support the massive application procedure platform which the original design has not expected.4 Structs function synopsisStruts is a MVC frame (Framework), uses in developing Java fast the Web application. Struts realizes the key point in C(Controller), Action which and we have custom-madeincluding ActionServlet/RequestProcessor, was also V(View) provides a series of rows to have custom-made the label (Custom Tag). Spring is a light vessel (light-weight container), its core is the Bean factory (Bean Factory), with constructs M(Model) which we need. Above this foundation, Spring has provided AOP (Aspect-Oriented Programming, face stratification plane programming) realization, provides under the non-management environment with it to declare services and so on way business, security; Is more convenient to Bean factory expansion ApplicationContext we to realize the J2EE application; DAO/ORM realizes facilitates us to carry on the database the development; Web MVC and Spring Web have provided Java the Web application frame or carries on the integration with other popular Web frame. That is may a both use, achieve both own characteristic carries on supplementary.Structs is the kind which, servlet and the JSP mark a group cooperates mutually, they compose the MVC 2 designs which may entrust with heavy responsibility. This definition expressed that Struts is a frame, but is not a storehouse, but Struts has also contained the rich mark storehouse and the independence in this frame work utility program class.Client browser (customer browser), the request founds an event from customer browser's each HTTP. The Web vessel will use a HTTP response to make the response.Controller (controller), the controller receive from browser's request, and decided that sends out where this request. Speaking of Struts, the controller is an order design pattern which realizes by servlet. struts-config.xml document disposition controller.Service logic, the service logic renewal model's condition, and helps the control application procedure the flow. Speaking of Struts, this is through takes the actual service logic “thin” the packing Action kind to complete.Model (model) condition, model expression application procedure condition. Service object renewal application procedure condition. ActionForm bean in conversation level or request level expression model condition, but is not in the lasting level. The JSP document uses JSP to mark the read from the ActionForm bean information.View (view), the view is a JSP document. And does not have the flow logic, does not have the service logic, also does not have the model information -- Only then marks. The mark causes Struts is different with other frames (for example Velocity) one of factors.Just like the Struts controller is (event usually is HTTP post) maps the event kind of servlet. you to expect - the air-operated controller use configuration files to cause you notto need to carry on to these values the hard code. The time has changed, but method as before.The Action kind, ActionForm maintains the Web application procedure the conversation condition. ActionForm is one abstract class, must found this kind of subclass for each input form model. When I said when input form model, what refers to the ActionForm expression is establishes or in the renewal general sense data by the HTML form.The Action kind is service logic packing. A Action kind of use is transforms HttpServletRequest into the service logic. Must use Action, please found its subclass and covers process () the method.ActionServlet (Command) will use perform () the method the parametrization kind to transmit for ActionForm. Still did not have too many repugnant request.getParameter () to transfer. When the event progresses to this step, the input form data (or HTML form data) has been withdrawn from the request class and shifts to the ActionForm kind.Considered that a Action kind of another way is the Adapter design pattern. The Action use will be “a kind of connection will transform another connection which will need for the client. Adapter enables the kind the joint operation, if does not have Adapter, then these kinds will be unable because of the incompatible connection the joint operation.”. In this example's client is ActionServlet, it knows nothing about to our concrete service class connection. Therefore, Struts has provided a service connection which it can understand, namely Action. Through expands Action, we cause our service connection and the Struts service connection maintain compatible.5 CSS synopsisThe CSS edition method is the same with HTML, may also be any text editor or the homepage edition software, but also has uses for to edit CSS specially the software. If you write the CSS sentence regards the exterior cascading style sheet, but transfers in the HTML document, then its extension saves .css to be possible. Initially the technical personnel found out HTML, mainly stresses on the definition content, for instance expressed that a paragraph, indicates the title, but excessively has not designed HTML the typesetting and the contact surface effect.Along with the Internet rapid development, HTML is widely applied, the surfer people hoped certainly that the homepage makes attractive, therefore the HTMLtypesetting and the contact surface effect's limitation exposes day by day. In order to solve this problem, the people also took many tortuous paths, has used some not good method, for instance increases many attribute results to HTML becomes the code very extremely fat, turns the picture the text, excessively many comes the typesetting using Table, expresses the white space with the blank picture and so on. Appears until CSS.CSS may be a homepage design breakthrough, it has solved the homepage contact surface typesetting difficult problem. May such say that HTML Tag is mainly defines the homepage content (Content), but CSS decided how these homepage content does demonstrate (Layout). The CSS English is Cascading Style Sheets, Chinese may translate the tandem cascading style sheet. CSS may divide into three kinds according to its position: In inlays the style (Inline Style), internal cascading style sheet (Internal Style Sheet), exterior cascading style sheet (External Style Sheet).6 HTML function synopsisHyper Text Markup the Language hypertext mark language is one kind uses for to manufacture the hypertext documents the simple mark language. The hypertext documents which compiles with HTML are called the HTML documents, it can the independence in each kind of operating system platform (for example UNIX, WINDOWS and so on). HTML has served as since 1990 on World Wide Web the information to express the language, uses in describing the Homepage form design and it and on WWW the other Homepage linked information.The HTML documents (i.e. the Homepage source document) was one has laid aside the mark ASCII text document, usually it had .html or the .htm document extension. Produces HTML documents mainly to have the following three ways: 1. the manual direct compilation (e.g. ASCII text editor which or other HTML edition tool likes with you). 2. will have other form documents through certain format conversion tool (for example the WORD documents) to transform the HTML documents. 3. by the Web server (or said that the HTTP server) one only then real-time dynamic produces. the HTML language is through uses each kind of mark (tags) to mark the documents the structure as well as marks the ultra chain (Hyperlink) the information.Although the HTML language described the documents structure form, but how can't define the documents information to precisely demonstrate and arrange, but is onlysuggested how the Web browser (for example Mosiac, Netscape and so on) should demonstrate and arrange these information, is decided finally in front of user's demonstration result by the Web browser's demonstration style and to the mark explanatory ability. Why is the identical documents the effect which demonstrated in the different browser meets is dissimilar. At present the HTML language's edition is 2.0, it is based on SGML (Standard Generalized Markup Language, standard sets at sign language generally, as soon as is applies mechanically describes digitized documents structure and manages its content complex standard) a subset to evolve comes. Although in next edition's standard HTML3.0 (is also called HTML+) to draw up, but some the partial experimental nature draft standard widely has been used, the mostly outstanding Web browser (for example Netscape and so on) can explain in the HTML3.0 part new mark, therefore introduced in this chapter some HTML3.0 new mark has been accepted by the most browsers.7 Js script language synopsisJS is javascrip, Javascript is one kind the script language which comes by the Netscape LiveScript development, the main purpose is to solve the server terminal language, for instance Perl, carry-over speed question. At that time served the end to need to carry on the confirmation to the data, because the network speed was quite slow, only then 28.8kbps, the confirmation step waste's time were too many. Therefore Netscape browser Navigator has joined Javascript, has provided the data confirmation basic function.The JavaScript official name is “ECMAScript”. This standard by ECMA organization development and maintenance. ECMA-262 is the official JavaScript standard. This standard based on JavaScript (Netscape) and JScript (Microsoft). Netscape (Navigator 2.0) Brendan Eich has invented this language, started from 1996, already appeared in all Netscape and in the Microsoft browser. The ECMA-262 development began in 1996, in 1997 July, the ECMA general meeting has accepted its first edition.Script script uses one specific descriptive language, rests on certain form compilation to be possible the execution document, is also called as great or the batch run document. The script usually may transfer temporarily by the application procedure and carry out. Each kind of script present widely is applied in the homepage design, because the script not only may reduce the homepage the scale and raises the homepage browsing speed,moreover may enrich the homepage performance, like animation, sound and so on. Cites a most common example, when we click in the homepage the E-mail address can transfer Outlook Express or the Foxmail this kind of mail software automatically, is realizes through the script function. Also because of script these characteristics, the human who harbors ulterior motives by some are often using. For example joins some destruction computer system's order in the script, like this works as the user browsing homepage, once transfers this kind of script, will then cause the user the system to come under the attack. Therefore the user should act according to visits homepage the trust degree selective security rank, specially regarding these itself content on the illegal homepage, do not permit the use script easily. Through “the safe establishment” the dialog box, the choice “the script” under option each kind of establishment may with ease realize to script being forbid and begins using.Present's script language is quite many, script language execution generally only with concrete explanation actuator related, so long as therefore on the system has the corresponding language interpreter to be possible to achieve the cross platform. Script (Script), is includes order and so on bind and alias sets, you may save this set are an independent document then in the time which needs carries out, like this may facilitate you in the CS use. The script may save for the suffix named .cfg document places under the cstrike folder, when execution in control bench input: exec (script filename) .cfg then. For instance saves a script is the buys.cfg document, inputs in the control bench: execbuys.cfg may realize the function which we need. Must realize an order, so long as is good this process definition (alias), and assigns a key position for this order, so long as later according to will assign the good key position, may realize this proceJSP及其WEB技术. 1 JSP简介JSP(JavaServer Pages)是一种基于Java的脚本技术。

JSP技术简介及特点(外文文献译文)

JSP技术简介及特点(外文文献译文)

JSP Technology Conspectus and SpecialtiesThe JSP (Java Server Pages) technology is used by the Sun micro-system issued by the company to develop dynamic Web application technology. With its easy, cross-platform, in many dynamic Web application programming languages, in a short spa n of a few years, has formed a complete set of standards, and widely used in electr onic commerce, etc. In China, the JSP now also got more extensive attention; get a good development, more and more dynamic website to JSP technology. The related technologies of JSP are briefly introduced.The JSP a simple technology can quickly and with the method of generating W eb pages. Use the JSP technology Web page can be easily display dynamic content. The JSP technology are designed to make the construction based on Web applicati ons easier and efficient, and these applications and various Web server, application server, the browser and development tools work together.The JSP technology isn't the only dynamic web technology, also not the first o ne, in the JSP technology existed before the emergence of several excellent dynami c web technologies, such as CGI, ASP, etc. With the introduction of these technolo gies under dynamic web technology, the development and the JSP. Technical JSP the development background and development historyIn web brief history, from a world wide web that most of the network informati on static on stock transactions evolution to acquisition of an operation and infrastru cture. In a variety of applications, may be used for based on Web client, look no res trictions.Based on the browser client applications than traditional based on client/server applications has several advantages. These benefits include almost no limit client a ccess and extremely simplified application deployment and management (to update an application, management personnel only need to change the program on a serve r, not thousands of installation in client applications). So, the software industry is r apidly to build on the client browser multilayer application.The rapid growth of exquisite based Web application requirements developme nt of technical improvements. Static HTML to show relatively static content is righ t choice, the new challenge is to create the interaction based on Web applications, i n these procedures, the content of a Web page is based on the user's request or the state of the system, and are not predefined characters.For the problem of an early solution is to use a CGI - BIN interface. Developer s write to interface with the relevant procedures and separate based on Web applica tions, the latter through the Web server to invoke the former. This plan has serious problem -- each new extensible CGI requirements in a new process on the server. I f multiple concurrent users access to this procedure, these processes will use the W eb server of all available resources, and the performance of the system will be redu ced to extremely low.Some Web server providers have to provide for their server by plugins "and" th e API to simplify the Web application development. These solutions are associated with certain Web server, cannot solve the span multiple suppliers solutions. For exa mple, Microsoft's Active Server mix (ASP) technology in the Web page to create d ynamic content more easily, but also can work in Microsoft on Personal Web Serve r and IIS.There are other solutions, but cannot make an ordinary page designers can easi ly master. For example, such as the Servlet Java technologies can use Java languag e interaction application server code easier. Developers to write such Servlet to rec eive signals from the Web browser to generate an HTTP request, a dynamic respon se (may be inquires the database to finish the request), then send contain HTML or XML documents to the response of the browser.Note: one is based on a Java Servlet Java technical operation in the server pro gram (with different, the latter operating in the Applet browser end). In this book th e Servlet chapter .Using this method, the entire page must have made in Java Servlet. If develope rs or Web managers want to adjust page, you'll have to edit and recompile the Servl et Java, even in logic has been able to run. Using this method, the dynamic content with the application of the page still need to develop skills.Obviously, what is needed is a industry to create dynamic content within the sc ope of the pages of the solution. This program will solve the current scheme are li mited. As follows:can on any Web server or applications. will application page displays and separation. can rapidly developing and testing.simplify the interactive development based on Web application process. TheJSP technology is designed to meet such requirements. The JSP specification is a Web server, application server, trading system and develops extensive cooperation between the tool suppliers. From this standard to develop the existing integration a nd balance of Java programming environment (for example, Java Servlet and Java Beans) support techniques and tools. The result is a kind of new and developing m ethod based on Web applications, using component-based application logic page de signers with powerful functions.Overall Semantics of a JSP PageA JSP page implementation class defines a JSP Service () method mapping fro m the request to the response object. Some details of this transformation are specifi c to the scripting language used (see Chapter JSP.9, “Scripting”). Most details are n ot language specific and are described in this chapter.The content of a JSP page is devoted largely to describing the data that is writt en into the output stream of the response. (The JSP container usually sends this dat a back to the client.) The description is based on a JSP Writer object that is expose d through the implicit object out (see Section JSP.1.8.3, “Implicit Objects”). Its val ue varies:Initially, out is a new JSP Writer object. This object may be different from the stream object returned from response, get Writer (), and may be considered to be in terposed on the latter in order to implement buffering (see Section JSP.1.10.1, “The page Directive”). This is the initial out object. JSP page authors are prohibited fro m writing directly to either the Print Writer or Output Stream associated with the S ervlet Response.The JSP container should not invoke response.get Writer () until the time when the first portion of the content is to be sent to the client. This enables a number of uses of JSP, including using JSP as a language to “glue” actions that deliver binary content, or reliably forwarding to a Servlet, or change dynamically the content type of the response before generating content. See Chapter JSP.4, “Internationalization Issues”.Within the body of some actions, out may be temporarily re-assigned to a diffe rent (nested) instance of a JSP Writer object. Whether this is the case depends on th e details of the action’s semantics. Typically the content of these temporary streams is appended to the stream previously referred to by out, and out is subsequently re-assigned to refer to the previous (nesting) stream. Such nested streams are always b uffered, and require explicit flushing to a nesting stream or their contents will be di scarded.If the initial out JSP Writer object is buffered, then depending upon the value o f the auto-Flush attribute of the page directive, the content of that buffer will either be automatically flushed out to the Servlet Response output stream to obviate overf low, or an exception shall be thrown to signal buffer overflow. If the initial out JSP Writer is unbuffered, then content written to it will be passed directly through to th e Servlet Response output stream.A JSP page can also describe what should happen when some specific events o ccur. In JSP 2.1, the only events that can be described are the initialization and the destruction of the page. These events are described using “well-known method na mes” in declaration elements..JavaScript is used for the first kind is browser, the dynamic general purpose of client scripting language. Netscape first proposed in 1995, but its JavaScript Live S cript called. Then quickly Netscape Live Script renamed JavaScript, Java develope rs with them from the same issued a statement. A statement Java and JavaScript wil l complement each other, but they are different, so the technology of the many dis missed the misunderstanding of the two technologies.JavaScript to create user interface control provides a scripting language. In fact , in the browser into the JavaScript code logic. It can support such effect: when the cursor on the Web page of a mobile user input validation or transform image.Microsoft also writes out their JavaScript version and the JSP script called. Mi crosoft and Netscape support JavaScript and JSP script around core characteristics and European Manufacturers is made by (ECMA) standards organization, the contr ol standard of scripting language. ECMA its scripting language ECMAScript name d.Servlets and JSP often include fragments of information that are common to an organization, such as logos, copyrights, trademarks, or navigation bars. The web a pplication uses the include mechanisms to import the information wherever it is ne eded, since it is easier to change content in one place then to maintain it in every pi ece of code where it is used. Some of this information is static and either never or r arely changes, such as an organization's logo. In other cases, the information is more dynamic and changes often and unpredictably, such as a textual greeting that mus t be localized for each user. In both cases, you want to ensure that the servlet or JS P can evolve independently of its included content, and that the implementation of the servlet or JSP properly updates its included content as necessary.You want to include a resource that does not change very much (such as a page fragment that represents a header or footer) in a JSP. Use the include directive in t he including JSP page, and give the included JSP segment a JSP extension.You want to include content in a JSP each time it receives a request, rather tha n when the JSP is converted to a servlet. Use the JSP: include standard action.You want to include a file dynamically in a JSP, based on a value derived from a configuration file. Use the JSP: include standard action. Provide the value in an external properties file or as a configuration parameter in the deployment descripto r.You want to include a fragment of an XML file inside of a JSP document, or in clude a JSP page in XML syntax. Use the JSP: include standard action for the inclu des that you want to occur with each request of the JSP. Use the JSP: directive.incl ude element if the includes action should occur during the translation phase.You want to include a JSP segment from outside the including file's context. U se the c: importThe operation principle and the advantages of JSP tagsIn this section of the operating principle of simple introduction JSP and strengt hs.For the first time in a JSP documents requested by the engine, JSP Servlet is tr ansformed into a document JSP. This engine is itself a Servlet. The operating proce ss of the JSP shown below:(1) The JSP engine put the JSP files converting a Java source files (Servlet), if you find the files have any grammar mistake JSP, conversion process will interrupt, and to the server and client output error messages.(2) If converted, with the engine JSP Java source file compiler into a correspon ding scale-up files.(3) To create a Servlet (JSP page), the transformation of the Servlet JSP Init () method was executed, JSP Init () method in the life cycle of Servlet executed only once.(4) JSP Service () method invocation to the client requests. For each request, J SP engine to create a new thread for processing the request. If you have multiple cl ients and request the JSP files, JSP engine will create multiple threads. Each client requests a thread. To execute multi-thread can greatly reduce the requirement of sy stem resources, improving the concurrency value and response time. But also shoul d notice the multi-thread programming, due to the limited Servlet always in respon se to memory, so is very fast.(5) If the file has been modified. The JSP, server will be set according to the do cument to decide whether to recompile, if need to recompile, will replace the Servl et compile the memory and continue the process.(6) Although the JSP efficiency is high, but at first when the need to convert and compile and some slight delay. In addition, if at any time due to reasons of syste m resources, JSP engine will in some way of uncertain Servlet will remove from m emory. When this happens JSP Destroy () method was first call.(7) And then Servlet examples were marked with "add" garbage collection. Bu t in JSP Init () some initialization work, if establish connection with database, or to establish a network connection, from a configuration file take some parameters, su ch as, in JSP Destroy () release of the corresponding resources.Based on a Java language has many other techniques JSP page dynamiccharacteristics, technical have embodied in the following aspects:One. Simplicity and effectivenessThe JSP dynamic web pages with the compilation of the static HTML pages of writing are very similar. Just in the original HTML page add JSP tags, or some of t he proprietary scripting (this is not necessary). So, a familiar with HTML page writ e design personnel may be easily performed JSP page development. And the devel opers can not only, and write script by JSP tags used exclusively others have writte n parts to realize dynamic pages. So, an unfamiliar with the web developers scripti ng language, can use the JSP make beautiful dynamic pages. And this in other dyna mic web development is impossible.Tow. The independence of the programThe JSP are part of the family of the API Java, it has the general characteristics of the cross-platform Java program. In other words, is to have the procedure, name ly the independence of the platform, 6 Write bid anywhere!Three. Procedures compatibilityThe dynamic content can various JSP form, so it can show for all kinds of cust omers, namely from using HTML/DHTML browser to use various handheld wirele ss equipment WML (for example, mobile phones and PDA), personal digital equip ment to use XML applications, all can use B2B JSP dynamic pages.Four. Program reusabilityIn the JSP page can not directly, but embedded scripting dynamic interaction w ill be cited as a component part. So, once such a component to write, it can be repe ated several procedures, the program of the reusability. Now, a lot of standard Java Beans library is a good example.JSP technology strengthTime to prepare, run everywhere. At this point Java better than PHP, in additio n to systems, the code not to make any changes.(2) The multi-platform support. Basically on all platforms of any development environment, in any environment for deployment in any environment in the expans ion. Compared ASP / PHP limitations are obvious.(3) A strong scalability. From only a small Jar documents can run Servlet JSP, t o the multiple servers clustering and load balancing, to multiple Application for tra nsaction processing, information processing, a server to numerous servers, Java sh ows a tremendous Vitality.(4) Diversification and powerful development tools support. This is similar to t he ASP, Java already has many very good development tools, and many can be free , and many of them have been able to run on a variety of platforms under.JSP technology vulnerable:(1) And the same ASP, Java is the advantage of some of its fatal problem. It is precisely because in order to cross-platform functionality, in order to extreme stretc hing capacity, greatly increasing the complexity of the product.(2) Java's speed is class to complete the permanent memory, so in some cases by the use of memory compared to the number of users is indeed a "minimum cost performance.”On the other hand, it also needs disk space to store a series of. Java d ocuments and. Class, as well as the corresponding versions of documents.Know servlets for four reasons:1. JSP pages get translated into servlets. You can't understand how JSP workswithout understanding servlets.2. JSP consists of static HTML, special-purpose JSP tags, and Java code. What kind of Java code? Servlet code! You can't write that code if you don't understand servlet programming.3. Some tasks are better accomplished by servlets than by JSP. JSP is good at g enerating pages that consist of large sections of fairly well structured HTML or oth er character data. Servlets are better for generating binary data, building pages with highly variable structure, and performing tasks (such as redirection) that involve li ttle or no output.4. Some tasks are better accomplished by a combination of servlets and JSP th an by either servlets or JSP alone.Versus JavaScriptJavaScript, which is completely distinct from the Java programming language, is normally used to dynamically generate HTML on the client, building parts of the Web page as the browser loads the document. This is a useful capability and does not normally overlap with the capabilities of JSP (which runs only on the server). J SP pages still include SCRIPT tags for JavaScript, just as normal HTML pages do. In fact, JSP can even be used to dynamically generate the JavaScript that will be se nt to the client. So, JavaScript is not a competing technology; it is a complementar y one.JSP is by no means perfect. Many people have pointed out features that could be improved. This is a good thing, and one of the advantages of JSP is that the spec ification is controlled by a community that draws from many different companies. So, the technology can incorporate improvements in successive releases.However, some groups have developed alternative Java-based technologies to t ry to address these deficiencies. This, in our judgment, is a mistake. Using a third-p arty tool like Apache Struts that augments JSP and servlet technology is a good ide a when that tool adds sufficient benefit to compensate for the additional complexity . But using a nonstandard tool that tries to replace JSP is a bad idea. When choosin g a technology, you need to weigh many factors: standardization, portability, integr ation, industry support, and technical features. The arguments for JSP alternatives have focused almost exclusively on the technical features part. But portability, stan dardization, and integration are also very important. For example, the servlet and JSP specifications define a standard directory structure for Web applications and pro vide standard files (.war files) for deploying Web applications. All JSP-compatible servers must support these standards. Filters can be set up to apply to any number o f servlets or JSP pages, but not to nonstandard resources. The same goes for Web a pplication security settings.JSP技术简介及特点JSP(Java Server Pages)技术是由Sun公司发布的用于开发动态Web应用的一项技术。

JSP应用框架论文中英文资料对照外文翻译文献综述

JSP应用框架论文中英文资料对照外文翻译文献综述

JSP应用框架中英文资料对照外文翻译文献综述JSP APPLICATION FRAMEWORKS1.1 WHAT ARE APPLICATION FRAMEWORKS:A framework is a reusable, semi-complete application that can be specialized to produce custom applications [Johnson]. Like people, software applications are more alike than they are different. They run on the same computers, expect input from the same devices, output to the same displays, and save data to the same hard disks. Developers working on conventional desktop applications are accustomed to toolkits and development environments that leverage the sameness between applications. Application frameworks build on this common ground to provide developers with a reusable structure that can serve as the foundation for their own products.A framework provides developers with a set of backbone components that have the following characteristics:Frameworks are the classic build-versus-buy proposition. If you build it, you will understand it when you are done—but how long will it be before you can roll your own? If you buy it, you will have to climb the learning curve—and how long is that going to take? There is no right answer here, but most observers would agree that frameworks such as Struts provide a significant return on investment compared to starting from scratch, especially for larger projects.1.2 OTHER TYPES OF FRAMEWORKS:The idea of a framework applies not only to applications but to application components as well. Throughout this article, we introduce other types of frameworks that you can use with Struts. These include the Lucene search engine, the Scaffold toolkit, the Struts validator, and the Tiles tag library. Like application frameworks, these tools provide semi-complete versions of a subsystem that can be specialized to provide a custom component.Some frameworks have been linked to a proprietary development environment. This is not the case with Struts or any of the other frameworks shown in this book. You can use anydevelopment environment with Struts: Visual Age for Java, JBuilder, Eclipse, Emacs, and Textpad are all popular choices among Struts developers. If you can use it with Java, you can use it with Struts.1.3 ENABLING TECHNOLPGIES:Applications developed with Struts are based on a number of enabling technologies. These components are not specific to Struts and underlie every Java web application. A reason that developers use frameworks like Struts is to hide the nasty details behind acronyms like HTTP, CGI, and JSP. As a Struts developer, you don’t need to be an alphabet soup guru, but a working knowledge of these base technologies can help you devise creative solutions to tricky problems.1.4 HYPERTEXT TRANSFER PROTOCOL (HTTP):When mediating talks between nations, diplomats often follow a formal protocol.Diplomatic protocols are designed to avoid misunderstandings and to keep negotiations from breaking down. In a similar vein, when computers need to talk, they also follow a formal protocol. The protocol defines how data is transmitted and how to decode it once it arrives. Web applications use the Hypertext Transfer Protocol (HTTP) to move data between the browser running on your computer and the application running on the server.Many server applications communicate using protocols other than HTTP. Some of these maintain an ongoing connection between the computers. The application server knows exactly who is connected at all times and can tell when a connection is dropped. Because they know the state of each connection and the identity of each person using it, these are known as stateful protocols.By contrast, HTTP is known as a stateless protocol. An HTTP server will accept any request from any client and will always provide some type of response, even if the response is just to say no. Without the overhead of negotiating and retaining a connection, stateless protocols can handle a large volume of requests. This is one reason why the Internet has been able to scale to millions of computers.Another reason HTTP has become the universal standard is its simplicity. An HTTP request looks like an ordinary text document. This has made it easy for applications to make HTTP requests. You can even send an HTTP request by hand using a standard utility such as Telnet. When the HTTP response comes back, it is also in plain text that developers can read.The first line in the HTTP request contains the method, followed by the location of the requested resource and the version of HTTP. Zero or more HTTP request headers follow the initial line. The HTTP headers provide additional information to the server. This can include the browser type and version, acceptable document types, and the browser’s cookies, just toname a few. Of the seven request methods, GET and POST are by far the most popular.Once the server has received and serviced the request, it will issue an HTTP response. The first line in the response is called the status line and carries the HTTP protocol version, a numeric status, and a brief description of the status. Following the status line, the server will return a set of HTTP response headers that work in a way similar to the request headers.As we mentioned, HTTP does not preserve state information between requests. The server logs the request, sends the response, and goes blissfully on to the next request. While simple and efficient, a stateless protocol is problematic for dynamic applications that need to keep track of their users.Cookies and URL rewriting are two common ways to keep track of users between requests. A cookie is a special packet of information on the user’s computer. URL rewriting stores a special reference in the page address that a Java server can use to track users. Both approaches are seamless, and using either means extra work when developing a web application. On its own, a standard HTTP web server does not traffic in dynamic content. It mainly uses the request to locate a file and then returns that file in the response. The file is typically formatted using Hypertext Markup Language (HTML) [W3C, HTML] that the web browser can format and display. The HTML page often includes hypertext links to other web pages and may display any number of other goodies, such as images and videos. The user clicks a link to make another request, and the process begins a new.Standard web servers handle static content and images quite well but need a helping hand to provide users with a customized, dynamic response.DEFINITION: Static content on the Web comes directly from text or data files, like HTML or JPEG files. These files might be changed from time to time, but they are not altered automatically when requested by a web browser. Dynamic content, on the other hand, is generated on the fly, typically in response to an individualized request from a browser.1.5 COMMON GATEWAY INTERFACE (CGI):The first widely used standard for producing dynamic content was the Common Gateway Interface (CGI). CGI uses standard operating system features, such as environment variables and standard input and output, to create a bridge, or gateway, between the web server and other applications on the host machine. The other applications can look at the request sent to them by the web server and create a customized response.When a web server receives a request that’s intended for a CGI program, it runs that program and provides the program with information from the incoming request. The CGI program runs and sends its output back to the server. The web server then relays the response to the browser.CGI defines a set of conventions regarding what information it will pass as environment variables and how it expects standard input and output to be used. Like HTTP, CGI is flexible and easy to implement, and a great number of CGI-aware programs have been written.The main drawback to CGI is that it must run a new copy of the CGI-aware program for each request. This is a relatively expensive process that can bog down high-volume sites where thousands of requests are serviced per minute. Another drawback is that CGI programs tend to be platform dependent. A CGI program written for one operating system may not run on another.1.6 JA V A SERVLETS:Sun’s Java Servlet platform directly addresses the two main drawbacks of CGI programs. First, servlets offer better performance and utilization of resources than conventional CGI programs. Second, the write-once, run-anywhere nature of Java means that servlets are portable between operating systems that have a Java Virtual Machine (JVM).A Servlet looks and feels like a miniature web server. It receives a request and renders a response. But, unlike conventional web servers, the Servlet application programming interface (API) is specifically designed to help Java developers create dynamic applications.The Servlet itself is simply a Java class that has been compiled into byte code, like any other Java object. The Servlet has access to a rich API of HTTP-specific services, but it is still just another Java object running in an application and can leverage all your other Java assets.To give conventional web servers access to servlets, the servlets are plugged into containers. The Servlet container is attached to the web server. Each Servlet can declare what URL patterns it would like to handle. When a request matching a registered pattern arrives, the web server passes the request to the container, and the container invokes the Servlet.But unlike CGI programs, a new Servlet is not created for each request. Once the container instantiates the Servlet, it will just create a new thread for each request. Java threads are much less expensive than the server processes used by CGI programs. Once the Servlet has been created, using it for additional requests incurs very little overhead. Servlet developers can use the init () method to hold references to expensive resources, such as database connections or EJB Home Interfaces, so that they can be shared between requests. Acquiring resources like these can take several seconds—which is longer than many surfers are willing to wait.The other edge of the sword is that, since servlets are multithreaded, Servlet developers must take special care to be sure their servlets are thread-safe.1.7 JA V ASERVER PAGES:While Java servlets are a big step up from CGI programs, they are not a panacea. Togenerate the response, developers are still stuck with using println statements to render the HTML. Code that looks like:out.println("<P>One line of HTML.</P>");out.println("<P>Another line of HTML.</P>");It is all too common in servlets that generate the HTTP response. There are libraries that can help you generate HTML, but as applications grow more complex, Java developers end up being cast into the role of HTML page designers. Meanwhile, given the choice, most project managers prefer to divide development teams into specialized groups. They like HTML designers to be working on the presentation while Java engineers sweat the business logic. Using servlets alone encourages mixing markup with business logic, making it difficult for team members to specialize.To solve this problem, Sun turned to the idea of using server pages to combine scripting and templating technologies into a single component. To build Java Server Pages, developers start by creating HTML pages in the same old way, using the same old HTML syntax. To bring dynamic content into the page, the developer can also place JSP scripting elements on the page. Scripting elements are tags that encapsulate logic that is recognized by the JSP. You can easily pick out scripting elements on JSP pages by looking for code that begins with <% and ends with %>.To be seen as a JSP page, the file just needs to be saved with an extension of jsp.When a client requests the JSP page, the container translates the page into a source code file for a Java Servlet and compiles the source into a Java class file—just as you would do if you were writing a Servlet from scratch. At runtime, the container can also check the last modified date of the JSP file against the class file. If the JSP file has changed since it was last compiled, the container will retranslate and rebuild the page all over again.Project managers can now assign the presentation layer to HTML developers, who then pass on their work to Java developers to complete the business-logic portion. The important thing to remember is that a JSP page is really just a Servlet. Anything you can do with a Servlet, you can do with a JSP.1.8 JA V ABEANS:JavaBeans are Java classes which conform to a set of design patterns that make them easier to use with development tools and other components.DEFINITION: A JavaBean is a reusable software component written in Java. To qualify as a JavaBean, the class must be concrete and public, and have a non-argument constructor. JavaBeans expose internal fields as properties by providing public methods that follow a consistent design pattern. Knowing that the property names follow this pattern, other Javaclasses are able to use introspection to discover and manipulate JavaBean properties.The JavaBean design patterns provide access to the bean’s internal state through two flavors of methods: accessors are used to read a JavaBean’s state; mutators are us ed to change a JavaBean’s state.Mutators are always prefixed with lowercase token set followed by the property name. The first character in the property name must be uppercase. The return value is always void—mutators only change property values, they do not retrieve them. The mutator for a simple property takes only one parameter in its signature, which can be of any type. Mutators are often nicknamed setters after their prefix.The mutator method signature for a weight property of the type Double would be:public void setWeight(Double weight);A similar design pattern is used to create the accessor method signature. Accessor methods are always prefixed with the lowercase token get, followed by the property name. The first character in the property name must be uppercase. The return value will match the method parameter in the corresponding mutator. Accessors for simple properties cannot accept parameters in their method signature. Not surprisingly, accessors are often called getters.The accessor method signature for our weight property is:public Double getWeight();If the accessor returns a logical value, there is a variant pattern. Instead of using the lowercase token get, a logical property can use the prefix is, followed by the property name. The first character in the property name must be uppercase. The return value will always be a logical value—either boolean or Boolean. Logical accessors cannot accept parameters in their method signature.The boolean accessor method signature for an on property would be:public boolean isOn();The canonical method signatures play an important role when working with Java- Beans. Other components are able to use the Java Reflection API to discover a JavaBean’s properties by looking for methods prefixed by set, is, or get. If a component finds such a signature on a JavaBean, it knows that the method can be used to access or change the bean’s properties.Sun introduced JavaBeans to work with GUI components, but they are now used with every aspect of Java development, including web applications. When Sun engineers developed the JSP tag extension classes, they designed them to work with JavaBeans. The dynamic data for a page can be passed as a JavaBean, and the JSP tag can then use the bean’s properties to customize the output.JSP应用框架1.1 什么是应用框架:框架(framework)是可以被重用的一种半成品的应用程序,我们可以用它来制作专门的定制程序。

JSP技术外文文献

JSP技术外文文献

JSP and WEB technologyKathy Sierra, Bert Bates1 JSP IntroductionJSP (JavaServer Pages) is a Java-based scripting technology. Is advocated by Sun Microsystems Inc., together with a number of companies involved in the establishment of a dynamic web page technology standards. JSP technology is somewhat similar to ASP technology, It is a traditional HTML p age file (*. htm, *. html) to insert Java program segment (Scriptlet) and JSP tag (tag), To form the JSP file(*jsp). Web development with JSP is a cross-platform applications that can run under Linux, but also in other operating systems. In the JSP of the many advantages, one of which is that it will be HTML encoded Web page from the business logic separated effectively. JSP access with reusable components, such as Servlet, JavaBean and Java-based Web applications. JSP also supports directly in the Web page embedded Java code. JSP can be used two ways to access documents: JSP documents sent by the browser request, the request sent to the Servlet. JSP technology uses Java programming language, XML-type tags and scriptlets, to have a package deal with the logi c of dynamic pages. Page tags and scriptlets can also exist in the server access to the resources of the application logic. JSP logic and We b page design and display isolated and support reusable component-based design, Web-based applications more quickly and easily developed.The Web server when meets visits the JSP homepage the request, first carries out segment, will then carry out the result code to return together with JSP in the document HTML for the customer. The insertion Java segment may operate t he database, again the directional homepage and so on, realizes the function which the establishment dynamic homepage needs. JSP and Java Servlet are the same, is in the server end execution, usually returns to this client side is a HTML text, therefore client side, so long as has the browser to be able to glance over.The JSP page is composed of the HTML code and the inserting Java code. The server in the page by the client side was requested that later will carry on processing to these Java code, will then produce the HTML page will return gives the client side the browser. Java Servlet is the JSP technology base, moreover the large-scale Web application procedure's development needs Java Servlet and the JSP coordination can complete. JSP had the Java technology simply easy to use, completeobject-oriented, had the platform independency, and safe reliable, mainly faced Internet's all characteristics.2 JSP computing techniqueTo carry on the dynamic website conveniently fast the development, JSP has made the improvement in the following several aspects, causes it to become builds the cross platform fast the dynamic website first choice plan.2.1 carries on the content production and the demonstration separatesWith the JSP technology, the Web page develop ment personnel may use HTML or the XML marking design and the formatted final page, and uses the JSP marking or the tootsy produces on page's dynamic content originally. Production content's logic is sealed in marks and in the JavaBeans module, and ties up in the script, all scripts in server end movement. Because core logic is sealed in marks and in JavaBeans, therefore the Web administrative personnels and the page designer, can edit and use the JSP page, but does not affect the content the production. In the server end, the JSP engine explained that the JSP marking and the script, produce the content which requested, and (or XML) page's form transmits the result by HTML the browser. This both are helpful in the author protects own code, and can guarantee any based on the HTML Web browser's complete usability.2.2 may entrust with heavy responsibility the moduleThe overwhelming majority JSP page relies on may entrust with heavy responsibility, the cross platform module (JavaBeans or Enterprise the JavaBea ns module) carries out complex processing which the application procedure requests. The development personnel can share and exchange the execution ordinary operation the module, or causes these modules uses for more users and the customer association. Has accelerated the overall development process based on module's method, and causes each kind of organization obtains balanced in their existing skill and in the optimized result development endeavor.2.3 uses markingThe Web page development personnel will not be the familiar script language programmers. The JSP technology has sealed many functions, these functions are easy to use, marking to carry on the dynamic content production with JSP in the related XML to need. The standard JSP marking can visit and t he instantiation JavaBeans module, the establishment or the retrieval module attribute, downloads Applet, as well as the execution difficulty with codes and the time-consuming function with other methods.2.4 adapts the platformNearly all platforms support Java, JSP+JavaBeans to be possible to pass unimpeded nearly under all platforms. Transplants from a platform to other platform, JSP and JavaBeans does not even need to translate, because the Java byte code is standard has nothing to do with the platform.2.5 database connectionIn Java connects the database the technology is the JDBC, Java procedure is connected through the JDBC driver and the database, operations and so on execution inquiry, extraction data. Sun Corporation has also developed JDBC-ODBC bridge, uses this technical Java procedure to be possible to visit has the ODBC driver database, at present the majority database systems have the ODBC driver, therefore the Java procedure can visit such as Oracle, Sybase, MS SQL Server and databases and so on MS Access. In addition, through the development marking storehouse, the JSP technology may further expand. The third party development personnel and other personnel may found their marking storehouse for the commonly used function. This enables the Web page development personnel to be able to use the familiar tool and to be similar to marking same carries out the specific function component to carry on the work. The JSP technology very easy conformity to many kinds of application architecture, to use the extant tool and the skill, and can expand to the support enterprise distributional application.3 Eclipse function synopsisMore and more Java development personnel already started the productivity which and the quality income appreciates Eclipse JDT to provide. It was the Java editor provides grammar Gao Liang to demonstrate that the formatting, the fold, the content were auxiliary, code template and so on many functions. It grows unceasingly available restructuring and the code generation function se t permits you in a higher rank the operation code, and automated usual code intensity duty and easy wrong duty. Moreover, in develops the code and uses JDT to compile and to carry out the JUnit test built-in support carries on the unit testing after the co de, may use Eclipse the first-class Java debugger debugging when the movement meets any question. Besides JDT, Eclipse SDK- the most popular downloading - also contains Plug-in Development Environment(PDE). PDE used the specific function to expand JDT to construct the Eclipse plug-in unit - based on the Eclipse application procedure basic construction agglomeration. In fact, uses the tool which provides by Eclipse itself to be able to surmount the Java development, may expand the existing Eclipse application procedure, or even founds the brand-new application procedure.Eclipse by a script level constitution, contains in many functional modules or the Eclipse terminology so-called “the plug-in unit”. The plug-in unit is provides all functions in the Eclipse application procedure the module. They cooperate through its API to pay the final outcome together. In Eclipse, even the most foundation's function, for instance the search and the start installment's plug-in unit, seals in the plug-in unit. In order to expand the existing Eclipse function or carry on the construction in above, the plug-in unit the concrete expansion contribution for the expansion spot which will expose by other plug-in units. Usually, the plug-in unit concentrates the specific region responsibility, and gives through or a many expansion way other responsibility designation other plug-in units. For example, aplug-in unit allows you parallel to compare two documents visibly the contents, but it will not care how to read these do cuments even how to explain these document structure; This is other plug-in unit's work. When compared with two documents, this plug-in unit first inspects whether to have another plug-in unit to be possible to explain these document structure. If found one, it to the plug-in unit inquiry related file organization information which found, and used this information in the comparison process.May see that the modular construction was Eclipse has provided the huge flexibility, and provided one to be possible to support the massive application procedure platform which the original design has not expected.4 Structs function synopsisStruts is a MVC frame (Framework), uses in developing Java fast the Web application. Struts realizes the key point in C(Controlle r), Action which and we have custom-made including ActionServlet/RequestProcessor, was also V(View) provides a series of rows to have custom-made the label (Custom Tag). Spring is a light vessel (light-weight container), its core is the Bean factory (Bean Factory), with constructs M(Model) which we need. Above this foundation, Spring has provided AOP (Aspect-Oriented Programming, face stratification plane programming) realization, provides under the non-management environment with it to declare services and so on way business, security; Is more convenient to Bean factory expansion ApplicationContext we to realize the J2EE application; DAO/ORM realizes facilitates us to carry on the database the development; Web MVC and Spring Web have provided Java the Web application frame or carries on the integration with other popular Web frame. That is may a both use, achieve both own characteristic carries on supplementary.Structs is the kind which, servlet and the JSP mark a group cooperates mutually, they compose the MVC 2 designs which may entrust with heavy responsibility. This definition expressed that Struts is a frame, but is not a storehouse, but Struts has also contained the rich mark storehouse and the independence in this frame work utility program class.Client browser (customer browser), the request founds an event from customer browser's each HTTP. The Web vessel will use a HTTP response to make the response.Controller (controller), the controller receive from browser's request, and decided that sends out where this request. Speaking of Struts, the controller is an order design pattern which realizes by servlet. struts-config.xml document disposition controller.Service logic, the service logic renewal model's condition, and helps the control application procedure the flow. Speaking of Struts, this is through takes the actual service logic “thin” the packing Action kind to complete.Model (model) condition, model expression application procedure condition. Service object renewal application procedure c ondition. ActionForm bean inconversation level or request level expression model condition, but is not in the lasting level. The JSP document uses JSP to mark the read from the ActionForm bean information.View (view), the view is a JSP document. And doe s not have the flow logic, does not have the service logic, also does not have the model information -- Only then marks. The mark causes Struts is different with other frames (for example Velocity) one of factors.Just like the Struts controller is (event usually is HTTP post) maps the event kind of servlet. you to expect - the air-operated controller use configuration files to cause you not to need to carry on to these values the hard code. The time has changed, but method as before.The Action kind, ActionForm maintains the Web application procedure the conversation condition. ActionForm is one abstract class, must found this kind of subclass for each input form model. When I said when input form model, what refers to the ActionForm expression is establi shes or in the renewal general sense data by the HTML form.The Action kind is service logic packing. A Action kind of use is transforms HttpServletRequest into the service logic. Must use Action, please found its subclass and covers process () the method.ActionServlet (Command) will use perform () the method the parametrization kind to transmit for ActionForm. Still did not have too many repugnantrequest.getParameter () to transfer. When the event progresses to this step, the input form data (or HTML form data) has been withdrawn from the request class and shifts to the ActionForm kind.Considered that a Action kind of another way is the Adapter design pattern. The Action use will be “a kind of connection will transform another connection which will need for the client. Adapter enables the kind the joint operation, if does not have Adapter, then these kinds will be unable because of the incompatible connection the joint operation. In this example's client is ActionServlet, it knows nothing about to our concrete service class connection. Therefore, Struts has provided a service connection which it can understand, namely Action. Through expands Action, we cause our service connection and the Struts service connection maintain compatible.5 CSS synopsisThe CSS edition method is the same with HTML, may also be any text editor or the homepage edition software, but also has uses for to edit CSS specially the software. If you write the CSS sentence regards the exterior cascading style sheet, but transfers in the HTML document, then its extension saves .css to be possible. Initially the technical personnel found out HTML, mainly stresses on the definition content, for instance expressed that a paragraph, indicates the title, but excessively has not designed HTML the typesetting and the contact surface effect.Along with the Internet rapid development, HTML is widely applied, the surfer people hoped certainly that the homepage makes attractive, therefore the HTMLtypesetting and the contact surface effect's limitat ion exposes day by day. In order to solve this problem, the people also took many tortuous paths, has used some not good method, for instance increases many attribute results to HTML becomes the code very extremely fat, turns the picture the text, excessiv ely many comes the typesetting using Table, expresses the white space with the blank picture and so on. Appears until CSS.CSS may be a homepage design breakthrough, it has solved the homepage contact surface typesetting difficult problem. May such say th at HTML Tag is mainly defines the homepage content (Content), but CSS decided how these homepage content does demonstrate (Layout). The CSS English is Cascading Style Sheets, Chinese may translate the tandem cascading style sheet. CSS may divide into three kinds according to its position: In inlays the style (Inline Style), internal cascading style sheet (Internal Style Sheet), exterior cascading style sheet (External Style Sheet).6 HTML function synopsisHyper Text Markup the Language hypertext mark language is one kind uses for to manufacture the hypertext documents the simple mark language. The hypertext documents which compiles with HTML are called the HTML documents, it can the independence in each kind of operating system platform (for example UNIX, WINDOWS and so on). HTML has served as since 1990 on World Wide Web the information to express the language, uses in describing the Homepage form design and it and on WWW the other Homepage linked information.The HTML documents (i.e. the Homepage source document) was one has laid aside the mark ASCII text document, usually it had .html or the .htm document extension. Produces HTML documents mainly to have the following three ways: 1. the manual direct compilation (e.g. ASCII text editor which or other HTM L edition tool likes with you). 2. will have other form documents through certain format conversion tool (for example the WORD documents) to transform the HTML documents. 3. by the Web server (or said that the HTTP server) one only thenreal-time dynamic produces. the HTML language is through uses each kind of mark (tags) to mark the documents the structure as well as marks the ultra chain (Hyperlink) the information.Although the HTML language described the documents structure form, but how can't define the documents information to precisely demonstrate and arrange, but is only suggested how the Web browser (for example Mosiac, Netscape and so on) should demonstrate and arrange these information, is decided finally in front of user's demonstration result b y the Web browser's demonstration style and to the mark explanatory ability. Why is the identical documents the effect which demonstrated in the different browser meets is dissimilar. At present the HTML language's edition is 2.0, it is based on SGML (Stan dard Generalized Markup Language, standard sets at sign language generally, as soon as is applies mechanically describes digitized documents structure and manages its contentcomplex standard) a subset to evolve comes. Although in next edition's standard HTML3.0 (is also called HTML+) to draw up, but some the partial experimental nature draft standard widely has been used, the mostly outstanding Web browser (for example Netscape and so on) can explain in the HTML3.0 part new mark, therefore introduced in this chapter some HTML3.0 new mark has been accepted by the most browsers.7 Js script language synopsisJS is javascrip, Javascript is one kind the script language which comes by the Netscape LiveScript development, the main purpose is to solve the server terminal language, for instance Perl, carry-over speed question. At that time served the end t o need to carry on the confirmation to the data, because the network speed was quite slow, only then 28.8kbps, the confirmation step waste's time were too many. Therefore Netscape browser Navigator has joined Javascript, has provided the data confirmation basic function.The JavaScript official name is “ECMAScript”. This standard by ECMA organization development and maintenance. ECMA-262 is the official JavaScript standard. This standard based on JavaScript (Netscape) and JScript (Microsoft). Netscape (Navigator 2.0) Brendan Eich has invented this language, started from 1996, already appeared in all Netscape and in the Microsoft browser. TheECMA-262 development be gan in 1996, in 1997 July, the ECMA general meeting has accepted its first edition.Script script uses one specific descriptive language, rests on certain form compilation to be possible the execution document, is also called as great or the batch run document. The script usually may transfer temporarily by the application procedure and carry out. Each kind of script present widely is applied in the homepage design, because the script not only may reduce the homepage the scale and raises the homepage browsing speed, moreover may enrich the homepage performance, like animation, sound and so on. Cites a most common example, when we click in the homepage the E-mail address can transfer Outlook Express or the Foxmail this kind of mail software automatically, is realizes through the script function. Also because of script these characteristics, the human who harbors ulterior motives by some are often using. For example joins some destruction computer system's order in the script, like this works as the user brows ing homepage, once transfers this kind of script, will then cause the user the system to come under the attack. Therefore the user should act according to visits homepage the trust degree selective security rank, specially regarding these itself content on the illegal homepage, do not permit the use script easily. Through “the safe establishment” the dialog box, the choice “the script” under option each kind of establishment may with ease realize to script being forbid and begins using.Present's script language is quite many, script language execution generallyonly with concrete explanation actuator related, so long as therefore on the system has the corresponding language interpreter to be possible to achieve the crossplatform. Script (Script), is includes order and so on bind and alias sets, you may save this set are an independent document then in the time which needs carries out, like this may facilitate you in the CS use. The script may save for the suffix named .cfg document places under the cstrike folder, when execution in control bench input: exec (script filename) .cfg then. For instance saves a script is the buys.cfg document, inputs in the control bench: execbuys.cfg may realize the function which we need. Must realize an order, so long as is g ood this process definition (alias), and assigns a key position for this order, so long as later according to will assign the good key position, may realize this process. All scripts are realize through this method.。

外文翻译--JSP及其WEB技术

外文翻译--JSP及其WEB技术

外文翻译原文及译文JSP and WEB technolog1 JSP IntroductionJSP (JavaServer Pages) is a Java-based scripting technology. Is advocated by Sun Microsystems Inc., together with a number of companies involved in the establishment of a dynamic web page technology standards. JSP technology is somewhat similar to ASP technology, It is a traditional HTML page file (*. htm, *. html) to insert Java program segment (Scriptlet) and JSP tag (tag), To form the JSP file(*jsp). Web development with JSP is a cross-platform applications that can run under Linux, but also in other operating systems. In the JSP of the many advantages, one of which is that it will be HTML encoded Web page from the business logic separated effectively. JSP access with reusable components, such as Servlet, JavaBean and Java-based Web applications. JSP also supports directly in the Web page embedded Java code. JSP can be used two ways to access documents: JSP documents sent by the browser request, the request sent to the Servlet. JSP technology uses Java programming language, XML-type tags and scriptlets, to have a package deal with the logic of dynamic pages. Page tags and scriptlets can also exist in the server access to the resources of the application logic. JSP logic and Web page design and display isolated and support reusable component-based design, Web-based applications more quickly and easily developed.The Web server when meets visits the JSP homepage the request, first carries out segment, will then carry out the result code to return together with JSP in the document HTML for the customer. The insertion Java segment may operate the database, again the directional homepage and so on, realizes the function which the establishment dynamic homepage needs. JSP and Java Servlet are the same, is in the server end execution, usually returns to this client side is a HTML text, therefore client side, so long as has the browser to be able to glance over.The JSP page is composed of the HTML code and the inserting Java code. The server in the page by the client side was requested that later will carry on processing to these Java code, will then produce the HTML page will return gives the client side the browser. Java Servlet is the JSP technology base, moreover the large-scale Web applicationprocedure's development needs Java Servlet and the JSP coordination can complete. JSP had the Java technology simply easy to use, complete object-oriented, had the platform independency, and safe reliable, mainly faced Internet's all characteristics.2 JSP computing techniqueTo carry on the dynamic website conveniently fast the development, JSP has made the improvement in the following several aspects, causes it to become builds the cross platform fast the dynamic website first choice plan.2.1 carries on the content production and the demonstration separatesWith the JSP technology, the Web page development personnel may use HTML or the XML marking design and the formatted final page, and uses the JSP marking or the tootsy produces on page's dynamic content originally. Production content's logic is sealed in marks and in the JavaBeans module, and ties up in the script, all scripts in server end movement. Because core logic is sealed in marks and in JavaBeans, therefore the Web administrative personnels and the page designer, can edit and use the JSP page, but does not affect the content the production. In the server end, the JSP engine explained that the JSP marking and the script, produce the content which requested, and (or XML) page's form transmits the result by HTML the browser. This both are helpful in the author protects own code, and can guarantee any based on the HTML Web browser's complete usability.2.2 may entrust with heavy responsibility the moduleThe overwhelming majority JSP page relies on may entrust with heavy responsibility, the cross platform module (JavaBeans or Enterprise the JavaBeans module) carries out complex processing which the application procedure requests. The development personnel can share and exchange the execution ordinary operation the module, or causes these modules uses for more users and the customer association. Has accelerated the overall development process based on module's method, and causes each kind of organization obtains balanced in their existing skill and in the optimized result development endeavor.2.3 uses markingThe Web page development personnel will not be the familiar script language programmers. The JSP technology has sealed many functions, these functions are easy touse, marking to carry on the dynamic content production with JSP in the related XML to need. The standard JSP marking can visit and the instantiation JavaBeans module, the establishment or the retrieval module attribute, downloads Applet, as well as the execution difficulty with codes and the time-consuming function with other methods.2.4 adapts the platformNearly all platforms support Java, JSP+JavaBeans to be possible to pass unimpeded nearly under all platforms. Transplants from a platform to other platform, JSP and JavaBeans does not even need to translate, because the Java byte code is standard has nothing to do with the platform.2.5 database connectionIn Java connects the database the technology is the JDBC, Java procedure is connected through the JDBC driver and the database, operations and so on execution inquiry, extraction data. Sun Corporation has also developed JDBC-ODBC bridge, uses this technical Java procedure to be possible to visit has the ODBC driver database, at present the majority database systems have the ODBC driver, therefore the Java procedure can visit such as Oracle, Sybase, MS SQL Server and databases and so on MS Access. In addition, through the development marking storehouse, the JSP technology may further expand. The third party development personnel and other personnel may found their marking storehouse for the commonly used function. This enables the Web page development personnel to be able to use the familiar tool and to be similar to marking same carries out the specific function component to carry on the work. The JSP technology very easy conformity to many kinds of application architecture, to use the extant tool and the skill, and can expand to the support enterprise distributional application.3 Eclipse function synopsisMore and more Java development personnel already started the productivity which and the quality income appreciates Eclipse JDT to provide. It was the Java editor provides grammar Gao Liang to demonstrate that the formatting, the fold, the content were auxiliary, code template and so on many functions. It grows unceasingly available restructuring and the code generation function set permits you in a higher rank the operation code, and automated usual code intensity duty and easy wrong duty. Moreover, in develops the codeand uses JDT to compile and to carry out the JUnit test built-in support carries on the unit testing after the code, may use Eclipse the first-class Java debugger debugging when the movement meets any question. Besides JDT, Eclipse SDK- the most popular downloading - also contains Plug-in Development Environment(PDE). PDE used the specific function to expand JDT to construct the Eclipse plug-in unit - based on the Eclipse application procedure basic construction agglomeration. In fact, uses the tool which provides by Eclipse itself to be able to surmount the Java development, may expand the existing Eclipse application procedure, or even founds the brand-new application procedure.Eclipse by a script level constitution, contains in many functional modules or the Eclipse terminology so-called “the plug-in unit”. The plug-in unit is provides all functions in the Eclipse application procedure the module. They cooperate through its API to pay the final outcome together. In Eclipse, even the most foundation's function, for instance the search and the start installment's plug-in unit, seals in the plug-in unit. In order to expand the existing Eclipse function or carry on the construction in above, the plug-in unit the concrete expansion contribution for the expansion spot which will expose by other plug-in units. Usually, the plug-in unit concentrates the specific region responsibility, and gives through or a many expansion way other responsibility designation other plug-in units. For example, a plug-in unit allows you parallel to compare two documents visibly the contents, but it will not care how to read these documents even how to explain these document structure; This is other plug-in unit's work. When compared with two documents, this plug-in unit first inspects whether to have another plug-in unit to be possible to explain these document structure. If found one, it to the plug-in unit inquiry related file organization information which found, and used this information in the comparison process.May see that the modular construction was Eclipse has provided the huge flexibility, and provided one to be possible to support the massive application procedure platform which the original design has not expected.4 Structs function synopsisStruts is a MVC frame (Framework), uses in developing Java fast the Web application. Struts realizes the key point in C(Controller), Action which and we have custom-madeincluding ActionServlet/RequestProcessor, was also V(View) provides a series of rows to have custom-made the label (Custom Tag). Spring is a light vessel (light-weight container), its core is the Bean factory (Bean Factory), with constructs M(Model) which we need. Above this foundation, Spring has provided AOP (Aspect-Oriented Programming, face stratification plane programming) realization, provides under the non-management environment with it to declare services and so on way business, security; Is more convenient to Bean factory expansion ApplicationContext we to realize the J2EE application; DAO/ORM realizes facilitates us to carry on the database the development; Web MVC and Spring Web have provided Java the Web application frame or carries on the integration with other popular Web frame. That is may a both use, achieve both own characteristic carries on supplementary.Structs is the kind which, servlet and the JSP mark a group cooperates mutually, they compose the MVC 2 designs which may entrust with heavy responsibility. This definition expressed that Struts is a frame, but is not a storehouse, but Struts has also contained the rich mark storehouse and the independence in this frame work utility program class.Client browser (customer browser), the request founds an event from customer browser's each HTTP. The Web vessel will use a HTTP response to make the response.Controller (controller), the controller receive from browser's request, and decided that sends out where this request. Speaking of Struts, the controller is an order design pattern which realizes by servlet. struts-config.xml document disposition controller.Service logic, the service logic renewal model's condition, and helps the control application procedure the flow. Speaking of Struts, this is through takes the actual service logic “thin” the packing Action kind to complete.Model (model) condition, model expression application procedure condition. Service object renewal application procedure condition. ActionForm bean in conversation level or request level expression model condition, but is not in the lasting level. The JSP document uses JSP to mark the read from the ActionForm bean information.View (view), the view is a JSP document. And does not have the flow logic, does not have the service logic, also does not have the model information -- Only then marks. The mark causes Struts is different with other frames (for example Velocity) one of factors.Just like the Struts controller is (event usually is HTTP post) maps the event kind of servlet. you to expect - the air-operated controller use configuration files to cause you notto need to carry on to these values the hard code. The time has changed, but method as before.The Action kind, ActionForm maintains the Web application procedure the conversation condition. ActionForm is one abstract class, must found this kind of subclass for each input form model. When I said when input form model, what refers to the ActionForm expression is establishes or in the renewal general sense data by the HTML form.The Action kind is service logic packing. A Action kind of use is transforms HttpServletRequest into the service logic. Must use Action, please found its subclass and covers process () the method.ActionServlet (Command) will use perform () the method the parametrization kind to transmit for ActionForm. Still did not have too many repugnant request.getParameter () to transfer. When the event progresses to this step, the input form data (or HTML form data) has been withdrawn from the request class and shifts to the ActionForm kind.Considered that a Action kind of another way is the Adapter design pattern. The Action use will be “a kind of connection will transform another connection which will need for the client. Adapter enables the kind the joint operation, if does not have Adapter, then these kinds will be unable because of the incompatible connection the joint operation.”.In this example's client is ActionServlet, it knows nothing about to our concrete service class connection. Therefore, Struts has provided a service connection which it can understand, namely Action. Through expands Action, we cause our service connection and the Struts service connection maintain compatible.5 CSS synopsisThe CSS edition method is the same with HTML, may also be any text editor or the homepage edition software, but also has uses for to edit CSS specially the software. If you write the CSS sentence regards the exterior cascading style sheet, but transfers in the HTML document, then its extension saves .css to be possible. Initially the technical personnel found out HTML, mainly stresses on the definition content, for instance expressed that a paragraph, indicates the title, but excessively has not designed HTML the typesetting and the contact surface effect.Along with the Internet rapid development, HTML is widely applied, the surfer people hoped certainly that the homepage makes attractive, therefore the HTMLtypesetting and the contact surface effect's limitation exposes day by day. In order to solve this problem, the people also took many tortuous paths, has used some not good method, for instance increases many attribute results to HTML becomes the code very extremely fat, turns the picture the text, excessively many comes the typesetting using Table, expresses the white space with the blank picture and so on. Appears until CSS.CSS may be a homepage design breakthrough, it has solved the homepage contact surface typesetting difficult problem. May such say that HTML Tag is mainly defines the homepage content (Content), but CSS decided how these homepage content does demonstrate (Layout). The CSS English is Cascading Style Sheets, Chinese may translate the tandem cascading style sheet. CSS may divide into three kinds according to its position: In inlays the style (Inline Style), internal cascading style sheet (Internal Style Sheet), exterior cascading style sheet (External Style Sheet).6 HTML function synopsisHyper Text Markup the Language hypertext mark language is one kind uses for to manufacture the hypertext documents the simple mark language. The hypertext documents which compiles with HTML are called the HTML documents, it can the independence in each kind of operating system platform (for example UNIX, WINDOWS and so on). HTML has served as since 1990 on World Wide Web the information to express the language, uses in describing the Homepage form design and it and on WWW the other Homepage linked information.The HTML documents (i.e. the Homepage source document) was one has laid aside the mark ASCII text document, usually it had .html or the .htm document extension. Produces HTML documents mainly to have the following three ways: 1. the manual direct compilation (e.g. ASCII text editor which or other HTML edition tool likes with you). 2. will have other form documents through certain format conversion tool (for example the WORD documents) to transform the HTML documents. 3. by the Web server (or said that the HTTP server) one only then real-time dynamic produces. the HTML language is through uses each kind of mark (tags) to mark the documents the structure as well as marks the ultra chain (Hyperlink) the information.Although the HTML language described the documents structure form, but how can't define the documents information to precisely demonstrate and arrange, but is onlysuggested how the Web browser (for example Mosiac, Netscape and so on) should demonstrate and arrange these information, is decided finally in front of user's demonstration result by the Web browser's demonstration style and to the mark explanatory ability. Why is the identical documents the effect which demonstrated in the different browser meets is dissimilar. At present the HTML language's edition is 2.0, it is based on SGML (Standard Generalized Markup Language, standard sets at sign language generally, as soon as is applies mechanically describes digitized documents structure and manages its content complex standard) a subset to evolve comes. Although in next edition's standard HTML3.0 (is also called HTML+) to draw up, but some the partial experimental nature draft standard widely has been used, the mostly outstanding Web browser (for example Netscape and so on) can explain in the HTML3.0 part new mark, therefore introduced in this chapter some HTML3.0 new mark has been accepted by the most browsers.7 Js script language synopsisJS is javascrip, Javascript is one kind the script language which comes by the Netscape LiveScript development, the main purpose is to solve the server terminal language, for instance Perl, carry-over speed question. At that time served the end to need to carry on the confirmation to the data, because the network speed was quite slow, only then 28.8kbps, the confirmation step waste's time were too many. Therefore Netscape browser Navigator has joined Javascript, has provided the data confirmation basic function.The JavaScript official name is “ECMAScript”. This standard by ECMA organizat ion development and maintenance. ECMA-262 is the official JavaScript standard. This standard based on JavaScript (Netscape) and JScript (Microsoft). Netscape (Navigator 2.0) Brendan Eich has invented this language, started from 1996, already appeared in all Netscape and in the Microsoft browser. The ECMA-262 development began in 1996, in 1997 July, the ECMA general meeting has accepted its first edition.Script script uses one specific descriptive language, rests on certain form compilation to be possible the execution document, is also called as great or the batch run document. The script usually may transfer temporarily by the application procedure and carry out. Each kind of script present widely is applied in the homepage design, because the script not only may reduce the homepage the scale and raises the homepage browsing speed,moreover may enrich the homepage performance, like animation, sound and so on. Cites a most common example, when we click in the homepage the E-mail address can transfer Outlook Express or the Foxmail this kind of mail software automatically, is realizes through the script function. Also because of script these characteristics, the human who harbors ulterior motives by some are often using. For example joins some destruction computer system's order in the script, like this works as the user browsing homepage, once transfers this kind of script, will then cause the user the system to come under the attack. Therefore the user should act according to visits homepage the trust degree selective security rank, specially regarding these itself content on the illegal homepage, do not permit the use script easily. Through “the safe establishment” the dialog box, the choice “the script” under option each kind of establishment may with ease re alize to script being forbid and begins using.Present's script language is quite many, script language execution generally only with concrete explanation actuator related, so long as therefore on the system has the corresponding language interpreter to be possible to achieve the cross platform. Script (Script), is includes order and so on bind and alias sets, you may save this set are an independent document then in the time which needs carries out, like this may facilitate you in the CS use. The script may save for the suffix named .cfg document places under the cstrike folder, when execution in control bench input: exec (script filename) .cfg then. For instance saves a script is the buys.cfg document, inputs in the control bench: execbuys.cfg may realize the function which we need. Must realize an order, so long as is good this process definition (alias), and assigns a key position for this order, so long as later according to will assign the good key position, may realize this proce沈阳航空航天大学毕业设计(论文)外文翻译——译文JSP及其WEB技术. 1 JSP简介JSP(JavaServer Pages)是一种基于Java的脚本技术。

外文文献及翻译-JSP发展历史中英文

外文文献及翻译-JSP发展历史中英文

外文文献及翻译-JSP发展历史中英文THE TECHNIQUE DEVELOPMENT HISTORY OF JSPBy:Kathy Sierra and Bert BatesThe Java Server Pages( JSP) is a kind of according to web of the script plait distance technique, similar carries the script language of Java in the server of the Netscape company of server- side JavaScript( SSJS) and the Active Server Pages(ASP) of the Microsoft. JSP compares the SSJS and ASP to have better can expand sex, and it is no more exclusive than any factory or some one particular server of Web. Though the norm of JSP is to be draw up by the Sun company of, any factory can carry out the JSP on own system.The After Sun release the JSP( the Java Server Pages) formally, the this kind of new Web application development technique very quickly caused the people's concern. JSP provided a special development environment for the Web application that establishes the high dynamic state. According to the Sun parlance, the JSP can adapt to include the Apache WebServer, IIS4.0 on the market at inside of 85% server product.This chapter will introduce the related knowledge of JSP and Databases, and JavaBean related contents, is all certainly rougher introduction among them basic contents, say perhaps to is a Guide only, if the reader needs the more detailed information, pleasing the book of consult the homologous JSP.1.1 GENERALIZEThe JSP(Java Server Pages) is from the company of Sun Microsystems initiate, the many companies the participate to the build up the together of the a kind the of dynamic the state web the page technique standard, the it have the it in the construction the of the dynamic state the web page the strong but the do not the especially of the function. JSP and the technique of ASP of the Microsoft is very alike. Both all provide the ability that mixes with a certain procedure code and is explain by the language engine to carry out the procedure code in the code of HTML. Underneath we are simple of carry on the introduction to it.JSP pages are translated into servlets. So, fundamentally, any task JSP pages can perform could also be accomplished by servlets. However, this underlying equivalence does not mean that servlets and JSP pages are equally appropriate in all scenarios. The issue is not the power of the technology, it is the convenience, productivity, and maintainability of one or the other. After all, anything you can do on a particularcomputer platform in the Java programming language you could also do in assembly language. But it still matters which you choose.JSP provides the following benefits over servlets alone:• It is easier to write and maintain the HTML. Your static code is ordinary HTML: no extra backslashes, no double quotes, and no lurking Java syntax.• You can use standard Web-site development tools. Even HTML tools that know nothing about JSP can be used because they simply ignore the JSP tags.• You can divide up your development team. The Java programmers can work on the dynamic code. The Web developers can concentrate on the presentation layer. On large projects, this division is very important. Depending on the size of your team and the complexity of your project, you can enforce a weaker or stronger separation between the static HTML and the dynamic content.Now, this discussion is not to say that you should stop using servlets and use only JSP instead. By no means. Almost all projects will use both. For some requests in your project, you will use servlets. For others, you will use JSP. For still others, you will combine them with the MVC architecture . You want the appropriate tool for the job, and servlets, by themselves, do not complete your toolkit.1.2 SOURCE OF JSPThe technique of JSP of the company of Sun, making the page of Web develop the personnel can use the HTML perhaps marking of XML to design to turn the end page with format. Use the perhaps small script future life of marking of JSP becomes the dynamic state on the page contents.( the contents changes according to the claim of) The Java Servlet is a technical foundation of JSP, and the large Web applies the development of the procedure to need the Java Servlet to match with with the JSP and then can complete, this name of Servlet comes from the Applet, the local translation method of now is a lot of, this book in order not to misconstruction, decide the direct adoption Servlet but don't do any translation, if reader would like to, can call it as" small service procedure". The Servlet is similar to traditional CGI, ISAPI, NSAPI etc. Web procedure development the function of the tool in fact, at use the Java Servlet hereafter, the customer need not use again the lowly method of CGI of efficiency, also need not use only the ability come to born page of Web of dynamic state in the method of API that a certain fixed Web server terrace circulate. Many servers of Web all support the Servlet, even not support the Servlet server of Web directly and can also pass the additional applied server and the mold pieces to support the Servlet. Receive benefit in the characteristic of the Java cross-platform, the Servlet is also a terrace irrelevant,actually, as long as match the norm of Java Servlet, the Servlet is complete to have nothing to do with terrace and is to have nothing to do with server of Web. Because the Java Servlet is internal to provide the service by the line distance, need not start a progress to the each claimses, and make use of the multi-threading mechanism can at the same time for several claim service, therefore the efficiency of Java Servlet is very high.But the Java Servlet also is not to has no weakness, similar to traditional CGI, ISAPI, the NSAPI method, the Java Servlet is to make use of to output the HTML language sentence to carry out the dynamic state web page of, if develop the whole website with the Java Servlet, the integration process of the dynamic state part and the static state page is an evil-foreboding dream simply. For solving this kind of weakness of the Java Servlet, the SUN released the JSP.A number of years ago, Marty was invited to attend a small 20-person 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 high-level manager from a very large software company 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 company'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 company would take technology from other companies and suborn it for their own purposes. But guess what? The shoe is on the other foot here. The Java community did not invent the idea of designing pages as a mixture of static HTML and dynamic code marked with special tags. For example, Cold Fusion did it years earlier. Even ASP (a product from the very software company 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.The JSP is an establishment at the model of Java servlets on of the expression layer technique, it makes the plait write the HTML to become more simple.Be like the SSJS, it also allows you carry the static state HTML contents and servers the script mix to put together the born dynamic state exportation. JSP the script language that the Java is the tacit approval, however, be like the ASP and can use other languages( such as JavaScriptand VBScript), the norm of JSP also allows to use other languages.1.3JSP CHARACTERISTICSIs a service according to the script language in some one language of the statures system this kind of discuss, the JSP should be see make is a kind of script language. However, be a kind of script language, the JSP seemed to be too strong again, almost can use all Javas in the JSP.Be a kind of according to text originally of, take manifestation as the central development technique, the JSP provided all advantages of the Java Servlet, and, when combine with a JavaBeans together, providing a kind of make contents and manifestation that simple way that logic separate. Separate the contents and advantage of logical manifestations is, the personnel who renews the page external appearance need not know the code of Java, and renew the JavaBeans personnel also need not be design the web page of expert in hand, can use to take the page of JavaBeans JSP to define the template of Web, to build up a from have the alike external appearance of the website that page constitute. JavaBeans completes the data to provide, having no code of Java in the template thus, this means that these templates can be written the personnel by a HTML plait to support. Certainly, can also make use of the Java Servlet to control the logic of the website, adjust through the Java Servlet to use the way of the document of JSP to separate website of logic and contents.Generally speaking, in actual engine of JSP, the page of JSP is the edit and translate type while carry out, not explain the type of. Explain the dynamic state web page development tool of the type, such as ASP, PHP3 etc., because speed etc. reason, have already can't satisfy current the large electronic commerce needs appliedly, traditional development techniques are all at to edit and translate the executive way change, such as the ASP → ASP+;PHP3 → PHP4.In the JSP norm book, did not request the procedure in the JSP code part( be called the Scriptlet) and must write with the Java definitely. Actually, have some engines of JSP are adoptive other script languages such as the EMAC- Script, etc., but actually this a few script languages also are to set up on the Java, edit and translate for the Servlet to carry out of. Write according to the norm of JSP, have no Scriptlet of relation with Java also is can of, however, mainly lie in the ability and JavaBeans, the Enterprise JavaBeanses because of the JSP strong function to work together, so even is the Scriptlet part not to use the Java, edit and translate of performance code also should is related with Java.1.4JSP MECHANISMTo comprehend the JSP how unite the technical advantage that above various speak of, come to carry out various result easily, the customer must understand the differentiation of" the module develops for the web page of the center" and" the page develops for the web page of the center" first.The SSJS and ASP are all in several year ago to release, the network of that time is still very young, no one knows to still have in addition to making all business, datas and the expression logic enter the original web page entirely heap what better solve the method. This kind of model that take page as the center studies and gets the very fast development easily. However, along with change of time, the people know that this kind of method is unwell in set up large, the Web that can upgrade applies the procedure. The expression logic write in the script environment was lock in the page, only passing to shear to slice and glue to stick then can drive heavy use. Express the logic to usually mix together with business and the data logics, when this makes be the procedure member to try to change an external appearance that applies the procedure but do not want to break with its llied business logic, apply the procedure of maintenance be like to walk the similar difficulty on the eggshell. In fact in the business enterprise, heavy use the application of the module already through very mature, no one would like to rewrite those logics for their applied procedure.HTML and sketch the designer handed over to the implement work of their design the Web plait the one who write, make they have to double work- Usually is the handicraft plait to write, because have no fit tool and can carry the script and the HTML contents knot to the server to put together. Chien but speech, apply the complexity of the procedure along with the Web to promote continuously, the development method that take page as the center limits sex to become to get up obviously.At the same time, the people always at look for the better method of build up the Web application procedure, the module spreads in customer's machine/ server the realm. JavaBeans and ActiveX were published the company to expand to apply the procedure developer for Java and Windows to use to come to develop the complicated procedure quickly by" the fast application procedure development"( RAD) tool. These techniques make the expert in the some realm be able to write the module for the perpendicular application plait in the skill area, but the developer can go fetch the usage directly but need not control the expertise of this realm.Be a kind of take module as the central development terrace, the JSP appeared. It with the JavaBeans and Enterprise JavaBeans( EJB) module includes the model of thebusiness and the data logic for foundation, provide a great deal of label and a script terraces to use to come to show in the HTML page from the contents of JavaBeans creation or send a present in return. Because of the property that regards the module as the center of the JSP, it can drive Java and not the developer of Java uses equally. Not the developer of Java can pass the JSP label( Tags) to use the JavaBeans that the deluxe developer of Java establish. The developer of Java not only can establish and use the JavaBeans, but also can use the language of Java to come to control more accurately in the JSP page according to the expression logic of the first floor JavaBeans.See now how JSP is handle claim of HTTP. In basic claim model, a claim directly was send to JSP page in. The code of JSP controls to carry on hour of the logic processing and module of JavaBeanses' hand over with each other, and the manifestation result in dynamic state bornly, mixing with the HTML page of the static state HTML code. The Beans can be JavaBeans or module of EJBs. Moreover, the more complicated claim model can see make from is request other JSP pages of the page call sign or Java Servlets.The engine of JSP wants to chase the code of Java that the label of JSP, code of Java in the JSP page even all converts into the big piece together with the static state HTML contents actually. These codes piece was organized the Java Servlet that customer can not see to go to by the engine of JSP, then the Servlet edits and translate them automatically byte code of Java.Thus, the visitant that is the website requests a JSP page, under the condition of it is not knowing, an already born, the Servlet actual full general that prepared to edit and translate completes all works, very concealment but again and efficiently. The Servlet is to edit and translate of, so the code of JSP in the web page does not need when the every time requests that page is explain. The engine of JSP need to be edit and translate after Servlet the code end is modify only once, then this Servlet that editted and translate can be carry out. The in view of the fact JSP engine auto is born to edit and translate the Servlet also, need not procedure member begins to edit and translate the code, so the JSP can bring vivid sex that function and fast developments need that you are efficiently.Compared with the traditional CGI, the JSP has the equal advantage. First, on the speed, the traditional procedure of CGI needs to use the standard importation of the system to output the equipments to carry out the dynamic state web page born, but the JSP is direct is mutually the connection with server. And say for the CGI, each interview needs to add to add a progress to handle, the progress build up and destroy by burning constantly and will be a not small burden for calculator of be the server of Web. Thenext in order, the JSP is specialized to develop but design for the Web of, its purpose is for building up according to the Web applied procedure, included the norm and the tool of a the whole set. Use the technique of JSP can combine a lot of JSP pages to become a Web application procedure very expediently.JSP的技术发展历史作者:Kathy Sierra and Bert BatesJava Server Pages(JSP)是一种基于web的脚本编程技术,类似于网景公司的服务器端Java脚本语言——server-side JavaScript(SSJS)和微软的Active Server Pages(ASP)。

JSP的技术发展历史 外文文献和翻译资料 中英文对照

JSP的技术发展历史  外文文献和翻译资料 中英文对照

外文资料原文THE TECHNIQUE DEVELOPMENT HISTORY OF JSPThe Java Server Pages( JSP) is a kind of according to web of the script plait distance technique, similar carries the script language of Java in the server of the Netscape company of server- side JavaScript( SSJS) and the Active Server Pages(ASP) of the Microsoft. JSP compares the SSJS and ASP to have better can expand sex, and it is no more exclusive than any factory or some one particular server of Web. Though the norm of JSP is to be draw up by the Sun company of, any factory can carry out the JSP on own system.1.1 GENER ALIZEThe JSP(Java Server Pages) is from the company of Sun Microsystems initiate, the many companies the participate to the build up the together of the a kind the of dynamic the state web the page technique standard, the it have the it in the construction the of the dynamic state the web page the strong but the do not the especially of the function. JSP and the technique of ASP of the Microsoft is very alike. Both all provide the ability that mixes with a certain procedure code and is explain by the language engine to carry out the procedure code in the code of HTML. Underneath we are simple of carry on the introduction to it.JSP pages are translated into servlets. So, fundamentally, any task JSP pages can perform could also be accomplished by servlets. However, this underlying equivalence does not mean that servlets and JSP pages are equally appropriate in all scenarios. The issue is not the power of the technology, it is the convenience, productivity, and maintainability of one or the other. After all, anything you can do on a particular computer platform in the Java programming language you could also do in assembly language. But it still matters which you choose.JSP provides the following benefits over servlets alone:• It is easier to write and maintain the HTML. Your static code is ordinary HTML: no extra backslashes, no double quotes, and no lurking Java syntax.• You can use standard Web-site development tools. Even HTML tools that know nothing about JSP can be used because they simply ignore the JSP tags.• You can divide up your development team. The Java programmers can work on the dynamic code. The Web developers can concentrate on the presentation layer. On large projects, this division is very important. Depending on the size of your team and the complexity of your project, you can enforce a weaker or stronger separation between the static HTML and the dynamic content.1.2 JSP CHARACTERISTICSIs a service according to the script language in some one language of the statures system this kind of discuss, the JSP should be see make is a kind of script language. However, be a kind of script language, the JSP seemed to be too strong again, almost can use all Javas in the JSP.Be a kind of according to text originally of, take manifestation as the central development technique, the JSP provided all advantages of the Java Servlet, and, when combine with a JavaBeans together, providing a kind of make contents and manifestation that simple way that logic separate. Separate the contents and advantage of logical manifestations is, the personnel who renews the page external appearance need not know the code of Java, and renew the JavaBeans personnel also need not be design the web page of expert in hand, can use to take the page of JavaBeans JSP to define the template of Web, to build up a from have the alike external appearance of the website that page constitute. JavaBeans completes the data to provide, having no code of Java in the template thus, this means that these templates can be written the personnel by a HTML plait to support. Certainly, can also make use of the Java Servlet to control the logic of the website, adjust through the Java Servlet to use the way of the document of JSP to separate website of logic and contents.Generally speaking, in actual engine of JSP, the page of JSP is the edit andtranslate type while carry out, not explain the type of. Explain the dynamic state web page development tool of the type, such as ASP, PHP3 etc., because speed etc. reason, have already can't satisfy current the large electronic commerce needs appliedly, traditional development techniques are all at to edit and translate the executive way change, such as the ASP → ASP+;PHP3 → PHP4.In the JSP norm book, did not request the procedure in the JSP code part( be called the Scriptlet) and must write with the Java definitely. Actually, have some engines of JSP are adoptive other script languages such as the EMAC- Script, etc., but actually this a few script languages also are to set up on the Java, edit and translate for the Servlet to carry out of. Write according to the norm of JSP, have no Scriptlet of relation with Java also is can of, however, mainly lie in the ability and JavaBeans, the Enterprise JavaBeanses because of the JSP strong function to work together, so even is the Scriptlet part not to use the Java, edit and translate of performance code also should is related with Java.1.3 JSP MECHANISMTo comprehend the JSP how unite the technical advantage that above various speak of, come to carry out various result easily, the customer must understand the differentiation of" the module develops for the web page of the center" and" the page develops for the web page of the center" first.The SSJS and ASP are all in several year ago to release, the network of that time is still very young, no one knows to still have in addition to making all business, datas and the expression logic enter the original web page entirely heap what better solve the method. This kind of model that take page as the center studies and gets the very fast development easily. However, along with change of time, the people know that this kind of method is unwell in set up large, the Web that can upgrade applies the procedure. The expression logic write in the script environment was lock in the page, only passing to shear to slice and glue to stick then can drive heavy use. Express the logic to usually mix together with business and the data logics, when this makes bethe procedure member to try to change an external appearance that applies the procedure but do not want to break with its llied business logic, apply the procedure of maintenance be like to walk the similar difficulty on the eggshell. In fact in the business enterprise, heavy use the application of the module already through very mature, no one would like to rewrite those logics for their applied procedure.HTML and sketch the designer handed over to the implement work of their design the Web plait the one who write, make they have to double work- Usually is the handicraft plait to write, because have no fit tool and can carry the script and the HTML contents knot to the server to put together. Chien but speech, apply the complexity of the procedure along with the Web to promote continuously, the development method that take page as the center limits sex to become to get up obviously.At the same time, the people always look for the better method of build up the Web application procedure, the module spreads in customer's machine/ server the realm. JavaBeans and ActiveX were published the company to expand to apply the procedure developer for Java and Windows to use to come to develop the complicated procedure quickly by" the fast application procedure development"( RAD) tool. These techniques make the expert in the some realm be able to write the module for the perpendicular application plait in the skill area, but the developer can go fetch the usage directly but need not control the expertise of this realm.Be a kind of take module as the central development terrace, the JSP appeared. It with the JavaBeans and Enterprise JavaBeans( EJB) module includes the model of the business and the data logic for foundation, provide a great deal of label and a script terraces to use to come to show in the HTML page from the contents of JavaBeans creation or send a present in return. Because of the property that regards the module as the center of the JSP, it can drive Java and not the developer of Java uses equally. Not the developer of Java can pass the JSP label( Tags) to use the JavaBeans that the deluxe developer of Java establish. The developer of Java not only can establish and use the JavaBeans, but also can use the language of Java to come to control more accurately in the JSP page according to the expression logic of the first floorJavaBeans.See now how JSP is handle claim of HTTP. In basic claim model, a claim directly was send to JSP page in. The code of JSP controls to carry on hour of the logic processing and module of JavaBeanses' hand over with each other, and the manifestation result in dynamic state bornly, mixing with the HTML page of the static state HTML code. The Beans can be JavaBeans or module of EJBs. Moreover, the more complicated claim model can see make from is request other JSP pages of the page call sign or Java Servlets.The engine of JSP wants to chase the code of Java that the label of JSP, code of Java in the JSP page even all converts into the big piece together with the static state HTML contents actually. These codes piece was organized the Java Servlet that customer can not see to go to by the engine of JSP, then the Servlet edits and translate them automatically byte code of Java.Thus, the visitant that is the website requests a JSP page, under the condition of it is not knowing, an already born, the Servlet actual full general that prepared to edit and translate completes all works, very concealment but again and efficiently. The Servlet is to edit and translate of, so the code of JSP in the web page does not need when the every time requests that page is explain. The engine of JSP need to be edit and translate after Servlet the code end is modify only once, then this Servlet that editted and translate can be carry out. The in view of the fact JSP engine auto is born to edit and translate the Servlet also, need not procedure member begins to edit and translate the code, so the JSP can bring vivid sex that function and fast developments need that you are efficiently.Compared with the traditional CGI, the JSP has the equal advantage. First, on the speed, the traditional procedure of CGI needs to use the standard importation of the system to output the equipments to carry out the dynamic state web page born, but the JSP is direct is mutually the connection with server. And say for the CGI, each interview needs to add to add a progress to handle, the progress build up and destroy by burning constantly and will be a not small burden for calculator of be the server of Web. The next in order, the JSP is specialized to develop but design for the Web of, its purpose is for building up according to the Web applied procedure, included the normand the tool of a the whole set. Use the technique of JSP can combine a lot of JSP pages to become a Web application procedure very expediently.外文资料译文JSP的技术发展历史Java Server Pages(JSP)是一种基于web的脚本编程技术,类似于网景公司的服务器端Java脚本语言——server-side JavaScript(SSJS)和微软的Active Server Pages(ASP)。

JSP的技术发展-中英文文献翻译

JSP的技术发展-中英文文献翻译

THE TECHNIQUE DEVELOPMENT HISTORY OF JSPBy:Kathy Sierra and Bert BatesSource:Servlet&JSPThe Java Server Pages( JSP) is a kind of according to web of the script plait distance technique, similar carries the script language of Java in the server of the Netscape company of server- side JavaScript( SSJS) and the Active Server Pages(ASP) of the Microsoft. JSP compares the SSJS and ASP to have better can expand sex, and it is no more exclusive than any factory or some one particular server of Web. Though the norm of JSP is to be draw up by the Sun company of, any factory can carry out the JSP on own system.The After Sun release the JSP( the Java Server Pages) formally, the this kind of new Web application development technique very quickly caused the people's concern. JSP provided a special development environment for the Web application that establishes the high dynamic state. According to the Sun parlance, the JSP can adapt to include the Apache WebServer, IIS4.0 on the market at inside of 85% server product.This chapter will introduce the related knowledge of JSP and Databases, and JavaBean related contents, is all certainly rougher introduction among them basic contents, say perhaps to is a Guide only, if the reader needs the more detailed information, pleasing the book of consult the homologous JSP.1.1 GENERALIZEThe JSP(Java Server Pages) is from the company of Sun Microsystems initiate, the many companies the participate to the build up the together of the a kind the of dynamic the state web the page technique standard, the it have the it in the construction the of the dynamic state the web page the strong but the do not the especially of the function. JSP and the technique of ASP of the Microsoft is very alike. Both all provide the ability that mixes with a certain procedure code and is explain by the language engine to carry out the procedure code in the code of HTML. Underneath we are simple of carry on the introduction to it.JSP pages are translated into servlets. So, fundamentally, any task JSP pages can perform could also be accomplished by servlets. However, this underlying equivalence does not mean that servlets and JSP pages are equally appropriate in all scenarios. The issue is not the power of the technology, it is the convenience, productivity, and maintainability of one or the other. After all, anything you can do on a particular computer platform in the Java programming language you could also do in assembly language. But it still matters which you choose.JSP provides the following benefits over servlets alone:• It is easier to write and maintain the HTML. Your static code is ordinary HTML: no extra backslashes, no double quotes, and no lurking Java syntax.• You can use standard Web-site development tools. Even HTML tools that know nothing about JSP can be used because they simply ignore the JSP tags.• You can divide up your development team. The Java programmers can work on the dynamic code. The Web developers can concentrate on the presentation layer. On large projects, this division is very important. Depending on the size of your team and the complexity of your project, you can enforce a weaker or stronger separation between the static HTML and the dynamic content.Now, this discussion is not to say that you should stop using servlets and use only JSP instead. By no means. Almost all projects will use both. For some requests in your project, you will use servlets. For others, you will use JSP. For still others, you will combine them with the MVC architecture . You want the appropriate tool for the job, and servlets, by themselves, do not complete your toolkit.1.2 SOURCE OF JSPThe technique of JSP of the company of Sun, making the page of Web develop the personnel can use the HTML perhaps marking of XML to design to turn the end page with format. Use the perhaps small script future life of marking of JSP becomes the dynamic state on the page contents.( the contents changes according to the claim of)The Java Servlet is a technical foundation of JSP, and the large Web applies the development of the procedure to need the Java Servlet to match with with the JSP and then can complete, this name of Servlet comes from the Applet, the local translation method of now is a lot of, this book in order not to misconstruction, decide the direct adoption Servlet but don't do any translation, if reader would like to, can call it as" small service procedure". The Servlet is similar to traditional CGI, ISAPI, NSAPI etc. Web procedure development the function of the tool in fact, at use the Java Servlet hereafter, the customer need not use again the lowly method of CGI of efficiency, also need not use only the ability come to born page of Web of dynamic state in the method of API that a certain fixed Web server terrace circulate. Many servers of Web all support the Servlet, even not support the Servlet server of Web directly and can also pass the additional applied server and the mold pieces to support the Servlet. Receive benefit in the characteristic of the Java cross-platform, the Servlet is also a terrace irrelevant, actually, as long as match the norm of Java Servlet, the Servlet is complete to have nothing to do with terrace and is to have nothing to do with server of Web. Because the Java Servlet is internal to provide the service by the line distance, need not start a progress to the each claimses, and makeuse of the multi-threading mechanism can at the same time for several claim service, therefore the efficiency of Java Servlet is very high.But the Java Servlet also is not to has no weakness, similar to traditional CGI, ISAPI, the NSAPI method, the Java Servlet is to make use of to output the HTML language sentence to carry out the dynamic state web page of, if develop the whole website with the Java Servlet, the integration process of the dynamic state part and the static state page is an evil-foreboding dream simply. For solving this kind of weakness of the Java Servlet, the SUN released the JSP.A number of years ago, Marty was invited to attend a small 20-person 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 high-level manager from a very large software company 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 company'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 company would take technology from other companies and suborn it for their own purposes. But guess what? The shoe is on the other foot here. The Java community did not invent the idea of designing pages as a mixture of static HTML and dynamic code marked with special tags. For example, Cold Fusion did it years earlier. Even ASP (a product from the very software company 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.The JSP is an establishment at the model of Java servlets on of the expression layer technique, it makes the plait write the HTML to become more simple.Be like the SSJS, it also allows you carry the static state HTML contents and servers the script mix to put together the born dynamic state exportation. JSP the script language that the Java is the tacit approval, however, be like the ASP and can use other languages( such as JavaScript and VBScript), the norm of JSP also allows to use other languages.1.3JSP CHARACTERISTICSIs a service according to the script language in some one language of the statures system this kind of discuss, the JSP should be see make is a kind of script language. However, be a kind of script language, the JSP seemed to be too strong again, almost can use all Javas in theJSP.Be a kind of according to text originally of, take manifestation as the central development technique, the JSP provided all advantages of the Java Servlet, and, when combine with a JavaBeans together, providing a kind of make contents and manifestation that simple way that logic separate. Separate the contents and advantage of logical manifestations is, the personnel who renews the page external appearance need not know the code of Java, and renew the JavaBeans personnel also need not be design the web page of expert in hand, can use to take the page of JavaBeans JSP to define the template of Web, to build up a from have the alike external appearance of the website that page constitute. JavaBeans completes the data to provide, having no code of Java in the template thus, this means that these templates can be written the personnel by a HTML plait to support. Certainly, can also make use of the Java Servlet to control the logic of the website, adjust through the Java Servlet to use the way of the document of JSP to separate website of logic and contents.Generally speaking, in actual engine of JSP, the page of JSP is the edit and translate type while carry out, not explain the type of. Explain the dynamic state web page development tool of the type, such as ASP, PHP3 etc., because speed etc. reason, have already can't satisfy current the large electronic commerce needs appliedly, traditional development techniques are all at to edit and translate the executive way change, such as the ASP → ASP+;PHP3 → PHP4.In the JSP norm book, did not request the procedure in the JSP code part( be called the Scriptlet) and must write with the Java definitely. Actually, have some engines of JSP are adoptive other script languages such as the EMAC- Script, etc., but actually this a few script languages also are to set up on the Java, edit and translate for the Servlet to carry out of. Write according to the norm of JSP, have no Scriptlet of relation with Java also is can of, however, mainly lie in the ability and JavaBeans, the Enterprise JavaBeanses because of the JSP strong function to work together, so even is the Scriptlet part not to use the Java, edit and translate of performance code also should is related with Java.1.4JSP MECHANISMTo comprehend the JSP how unite the technical advantage that above various speak of, come to carry out various result easily, the customer must understand the differentiation of" the module develops for the web page of the center" and" the page develops for the web page of the center" first.The SSJS and ASP are all in several year ago to release, the network of that time is still very young, no one knows to still have in addition to making all business, datas and the expression logic enter the original web page entirely heap what better solve the method. This kind of model that take page as the center studies and gets the very fast development easily.However, along with change of time, the people know that this kind of method is unwell in set up large, the Web that can upgrade applies the procedure. The expression logic write in the script environment was lock in the page, only passing to shear to slice and glue to stick then can drive heavy use. Express the logic to usually mix together with business and the data logics, when this makes be the procedure member to try to change an external appearance that applies the procedure but do not want to break with its llied business logic, apply the procedure of maintenance be like to walk the similar difficulty on the eggshell. In fact in the business enterprise, heavy use the application of the module already through very mature, no one would like to rewrite those logics for their applied procedure.HTML and sketch the designer handed over to the implement work of their design the Web plait the one who write, make they have to double work- Usually is the handicraft plait to write, because have no fit tool and can carry the script and the HTML contents knot to the server to put together. Chien but speech, apply the complexity of the procedure along with the Web to promote continuously, the development method that take page as the center limits sex to become to get up obviously.At the same time, the people always at look for the better method of build up the Web application procedure, the module spreads in customer's machine/ server the realm. JavaBeans and ActiveX were published the company to expand to apply the procedure developer for Java and Windows to use to come to develop the complicated procedure quickly by" the fast application procedure development"( RAD) tool. These techniques make the expert in the some realm be able to write the module for the perpendicular application plait in the skill area, but the developer can go fetch the usage directly but need not control the expertise of this realm.Be a kind of take module as the central development terrace, the JSP appeared. It with the JavaBeans and Enterprise JavaBeans( EJB) module includes the model of the business and the data logic for foundation, provide a great deal of label and a script terraces to use to come to show in the HTML page from the contents of JavaBeans creation or send a present in return. Because of the property that regards the module as the center of the JSP, it can drive Java and not the developer of Java uses equally. Not the developer of Java can pass the JSP label( Tags) to use the JavaBeans that the deluxe developer of Java establish. The developer of Java not only can establish and use the JavaBeans, but also can use the language of Java to come to control more accurately in the JSP page according to the expression logic of the first floor JavaBeans.See now how JSP is handle claim of HTTP. In basic claim model, a claim directly was send to JSP page in. The code of JSP controls to carry on hour of the logic processing and module of JavaBeanses' hand over with each other, and the manifestation result in dynamic state bornly, mixing with the HTML page of the static state HTML code. The Beans can beJavaBeans or module of EJBs. Moreover, the more complicated claim model can see make from is request other JSP pages of the page call sign or Java Servlets.The engine of JSP wants to chase the code of Java that the label of JSP, code of Java in the JSP page even all converts into the big piece together with the static state HTML contents actually. These codes piece was organized the Java Servlet that customer can not see to go to by the engine of JSP, then the Servlet edits and translate them automatically byte code of Java.Thus, the visitant that is the website requests a JSP page, under the condition of it is not knowing, an already born, the Servlet actual full general that prepared to edit and translate completes all works, very concealment but again and efficiently. The Servlet is to edit and translate of, so the code of JSP in the web page does not need when the every time requests that page is explain. The engine of JSP need to be edit and translate after Servlet the code end is modify only once, then this Servlet that editted and translate can be carry out. The in view of the fact JSP engine auto is born to edit and translate the Servlet also, need not procedure member begins to edit and translate the code, so the JSP can bring vivid sex that function and fast developments need that you are efficiently.Compared with the traditional CGI, the JSP has the equal advantage. First, on the speed, the traditional procedure of CGI needs to use the standard importation of the system to output the equipments to carry out the dynamic state web page born, but the JSP is direct is mutually the connection with server. And say for the CGI, each interview needs to add to add a progress to handle, the progress build up and destroy by burning constantly and will be a not small burden for calculator of be the server of Web. The next in order, the JSP is specialized to develop but design for the Web of, its purpose is for building up according to the Web applied procedure, included the norm and the tool of a the whole set. Use the technique of JSP can combine a lot of JSP pages to become a Web application procedure very expediently.JSP的技术发展历史作者:Kathy Sierra and Bert Bates来源:Servlet&JSPJava Server Pages(JSP)是一种基于web的脚本编程技术,类似于网景公司的服务器端Java脚本语言——server-side JavaScript(SSJS)和微软的Active Server Pages(ASP)。

Jsp最佳实践外文文献翻译、中英文翻译、外文翻译

Jsp最佳实践外文文献翻译、中英文翻译、外文翻译

JSP best practicesJavaServer Pages (JSPs) technology is an extension of Java servlet technology and combines HTML and Java code into a single file. While Java servlet technology focuses on Java classes capable of generating HTML output with PrintWriter.println() statements, JSP technology abstracts this concept to a higher level. With JavaServer Pages, a Web developer can write static HTML pages and simply add Java code in those sections of the page that need to be dynamically generated. While this flexibility enables rapid development of simple Web applications, it can be abused, resulting in unnecessarily complex applications that are difficult to maintain, reuse, and enhance.To avoid needlessly complex applications, follow the practices I present in this article:1. Separate HTML from Java2. Place business logic in JavaBeans3. Factor general behavior out of custom tag handler classes4. Favor HTML in Java handler classes over Java in JSPs5. Use an appropriate inclusion mechanism6. Use a JSP template mechanism7. Use stylesheets8. Use the MVC pattern9. Use available custom tag libraries10. Use JSP comments in most cases11. Follow HTML best practices12. Utilize the JSP exception mechanismThese tips will help you write JSPs that are reusable and easy to maintain.(1)Separate HTML from JavaIt can be tempting to throw all Java and HTML code necessary for a Webpage into a single JSP file. In simple system development, such an approach makes it easy for someone new to the system to locate all relevant code in one place and understand how itall interacts. However, this approach becomes burdensome and costly when the application grows more complex and more developers become involved.Combining HTML and Java in the same source code can make the code significantly less readable. To enhance software readability, developers often use indentation; but mixing HTML and Java scriptlets in the same file can make useful indentation extremely difficult to maintain.Many Web development methodologies and architectures now emphasize the separation of HTML from Java code so different developers can focus on their strengths. Properly separating Java and HTML, including HTML-like JSP tags and custom tags, allows Web designers and HTML coders to work on the HTML (presentation) aspects, while Java developers work on the application′s Java (processing logic) portions. Java developers focus on business logic as they implement the behavior behind the custom tags; Web designers then use these custom tags just as they use ordinary HTML tags.(2)Place business logic in JavaBeansJava code included directly inside a JSP is not as readily accessible to other JSPs as Java code contained within a JavaBean. Common behavior and business logic placed in JavaBeans can not only be used by other JSPs but also by other portions of the application. That is because JavaBeans are merely Java classes that satisfy some basic conventions (such as a constructor with no arguments and public get/set methods for private data members) and can be used as any other Java class. Note that Enterprise JavaBeans (EJBs) are also useful for storing behaviors and data common to all components of the application.(3)Factor general behavior out of custom tag handler classesJava classes known as custom tag handlers implement custom tags. Unlike JavaBeans, custom tag handler classes are not readily used like ordinary Java utility classes. Instead, custom tag handler classes implement specific interfaces -- or extend classes that provide these interfaces′basic implementations. Because they are not readily reused outside JSPs, custom tag handlers should contain only specific behavior that would not be useful outside that custom tag -- that is, outside the JSP. Custom tags often require support for common behaviors or business logic and can utilize JavaBeans or EJBs that perform those common behaviors.(4)Favor HTML in Java handler classes over Java in JSPsSometimes cleanly separating HTML, JSP tags, and HTML-like custom tags from Java requires unnecessarily convoluted code. In these cases, you either include Java scriptlets and expressions in the JSP or put some HTML code in the Java tag handler class.I′d rather see a small amount of HTML code in the Java class than see Java, such as scriptlets and expressions, in the JSP. Since custom tag handlers are specific to the custom tags they implement (and not reusable outside JSPs), placing necessary HTML there is not troublesome. Sun′s Java 2 Platform, Enterprise Edition (J2EE) Blueprints documentation discusses this issue further.(5)Use an appropriate inclusion mechanismIt is rarely good design to reproduce code commonly used by different application pieces each time another piece of that application needs that functionality. Factoring common JSP or HTML code out of multiple pages and into a single file improves maintainability (you need to make changes in only one location) and reusability.Two JSP include mechanisms reduce code redundancy and promote reusability; to ensure that you use the appropriate include mechanism, it is important to know the differences between the two. Generally, I use the include directive unless I can justify a need for the include action. Question 7 in the Blueprints′"Web Tier" section provides a good resource for understanding the differences between the two include mechanisms and determining which to use in a particular situation.(6)Use a JSP template mechanismA template mechanism allows for a common file to control Webpage, or JSP, layout. Then, when you want to change the layout, you need to modify only one file, and all the other pages will reflect the layout change. This doesn′t just make for more maintainable code; using templates to control layout also makes Webpages more aesthetically pleasing to users who see consistent layouts for all an application′s pages.(7)Use stylesheetsJust as templates enable developers to place layout control in a single location, stylesheets enable developers to place appearance control in a single location. I use Cascading Style Sheets (CSS) to control such items as font families, font sizes, and table characteristics. Like templates, stylesheets allow the developer to make changes in onelocation; those changes immediately reflect on all appropriate pages, resulting in increased maintainability and consistent appearance to users.(8)Use the MVC patternWhile other design patterns can be used effectively with JSPs, I often use the Model-View-Controller (MVC) architecture with JSP technology. MVC enables the development of applications that are easier to create, test, maintain, and enhance. In JSP terminology, implementation of an MVC architecture is often referred to as Model 2 (from an early JSP specification). The J2EE Blueprints samples are based on MVC.(9)Use available custom tag librariesWhy should developers spend time reinventing the wheel and worrying about testing and debugging when custom tag libraries are readily available for many different purposes? Some vendors provide custom tag libraries to their customers for free or for individual purchase, but many custom tags can be found online. Resources provides a good starting point for locating potentially useful tag libraries.While these third-party custom tag libraries occasionally have bugs, most likely such problems will be discovered, since many developers use these libraries and test them in their own applications. Also, many custom tags are open source, so you can edit them to meet your needs.I find it well worth my time to keep informed of available custom tags, since these libraries often provide functionality common to most Web applications. While learning about available custom tag libraries requires a small time investment, reusing already-available custom tags saves the time of writing, testing, and debugging my own custom tags. As mentioned above, many tag libraries are also open source; in these cases,I can readily adapt general behavior to my specific project′s situation.(10)Use JSP comments in most casesAppropriate commenting seems to challenge software developers. JSPs, like other types of code, should include comments that describe complex or extraordinary functionality, the pages′purpose, and other general information typically commented out in source code.Since JSPs allow developers to intermix Java, JSP tags, and HTML tags in the same page, there are multiple ways to comment a JSP page. Developers should carefully consider which type of comment to employ in the page. HTML comments will beviewable in the compiled JSP′s HTML source code, and both major browsers make viewing this source easy. JSP comments, on the other hand, are not placed in the HTML document created by the JSP compilation process. These comments cannot be viewed as part of the page′s source through the browser, and they do not increase the size of the rendered page′s generated source. Java comments can also occur in a JSP inside Java scriptlet sections. These are not viewable in the browser either, but including Java comments in the JSP page violates the principle of separating Java from the HTML.Code comments are usually meant for developers who write and maintain code. Therefore, use JSP comments unless there is a compelling reason to have the comments display in the browser upon request.(11)Follow HTML best practicesWhen Java is factored out of the JSP and into JavaBeans and custom tag handlers, the JSP consists mostly of JSP tags, including custom tags, and HTML tags. To make the JSP easier to understand and maintain, follow best practices related to HTML development.(12)Utilize the JSP exception mechanismWhile a thrown exception′s stack trace proves extremely useful for developers when debugging their code, it is rarely desirable to share an entire exception stack trace with the software′s users. Lengthy stack traces are not aesthetically pleasing and can increase security risks by exposing information that does not need to be released. JSPs allow developers to catch and handle exceptions in the code, resulting in more secure and aesthetically pleasing exception handling. See Resources for details on the mechanics of JSP exception handling.Exception information is more useful if information besides the stack trace is included. JSPs can use session variables to store information about the current page and current operation being performed. Then, if an exception does occur, the exception page will be called; it will have access to both the thrown exception and the information about the original page that caused the exception. The exception page can utilize underlying Java code, in JavaBeans or EJBs, to store in the database the complete exception information, related session information, and the exception′s date and time.To reduce the unsightly error messages printed to the screen and improve security, the exception page need only print out a simple error message and perhaps an identifyingnumber that allows developers to locate more detailed exception information in the database. For aesthetic and security reasons, I prefer storing most of the exception information in a database or flat file rather than printing it all to the screen. Storing the exception information in a database or flat file also allows the information to be persisted even when a user exits the application. Note that during development you should print full exception information to the screen for regular testing and debugging.Jsp最佳实践Jsp技术是servlet技术的扩展,结合html、java代码于一个文件。

Servlet和JSP技术简述中英文资料对照外文翻译文献综述

Servlet和JSP技术简述中英文资料对照外文翻译文献综述

Servlet和JSP技术简述中英文资料对照外文翻译文献综述An Overview of Servlet and JSP Technology 1.1 A Servlet's JobServlets are Java programs that run on Web or application servers, acting as a middle layer between requests coming from Web browsers or other HTTP clients and databases or applications on the HTTP server. Their job is to perform the following tasks, as illustrated in Figure 1-1.Figure 1-11.Read the explicit data sent by the client.The end user normally enters this data in an HTML form on a Web page. However, the data could also come from an applet or a custom HTTP client program.2.Read the implicit HTTP request data sent by the browser.Figure 1-1 shows a single arrow going from the client to the Web server (the layer where servlets and JSP execute), but there are really two varieties of data: the explicit data that the end user enters in a form and the behind-the-scenes HTTP information. Both varieties are critical. The HTTP information includes cookies, information about media types and compression schemes the browser understands, and so on. 3.Generate the results.This process may require talking to a database, executing an RMI or EJB call, invoking a Web service, or computing the response directly. Your real data may be ina relational database. Fine. But your database probably doesn't speak HTTP or return results in HTML, so the Web browser can't talk directly to the database. Even if it could, for security reasons, you probably would not want it to. The same argument applies to most other applications. You need the Web middle layer to extract the incoming data from the HTTP stream, talk to the application, and embed the results inside a document.4.Send the explicit data (i.e., the document) to the client.This document can be sent in a variety of formats, including text (HTML or XML), binary (GIF images), or even a compressed format like gzip that is layered on top of some other underlying format. But, HTML is by far the most common format, so an important servlet/JSP task is to wrap the results inside of HTML.5.Send the implicit HTTP response data.Figure 1-1 shows a single arrow going from the Web middle layer (the servlet or JSP page) to the client. But, there are really two varieties of data sent: the document itself and the behind-the-scenes HTTP information. Again, both varieties are critical to effective development. Sending HTTP response data involves telling the browser or other client what type of document is being returned (e.g., HTML), setting cookies and caching parameters, and other such tasks.1.2 Why Build Web Pages Dynamically?many client requests can be satisfied by prebuilt documents, and the server would handle these requests without invoking servlets. In many cases, however, a static result is not sufficient, and a page needs to be generated for each request. There are a number of reasons why Web pages need to be built on-the-fly:1.The Web page is based on data sent by the client.For instance, the results page from search engines and order-confirmation pages at online stores are specific to particular user requests. You don't know what to display until you read the data that the user submits. Just remember that the user submits two kinds of data: explicit (i.e., HTML form data) and implicit (i.e., HTTP requestheaders). Either kind of input can be used to build the output page. In particular, it is quite common to build a user-specific page based on a cookie value.2.The Web page is derived from data that changes frequently.If the page changes for every request, then you certainly need to build the response at request time. If it changes only periodically, however, you could do it two ways: you could periodically build a new Web page on the server (independently of client requests), or you could wait and only build the page when the user requests it. The right approach depends on the situation, but sometimes it is more convenient to do the latter: wait for the user request. For example, a weather report or news headlines site might build the pages dynamically, perhaps returning a previously built page if that page is still up to date.3.The Web page uses information from corporate databases or other server-side sources.If the information is in a database, you need server-side processing even if the client is using dynamic Web content such as an applet. Imagine using an applet by itself for a search engine site:"Downloading 50 terabyte applet, please wait!" Obviously, that is silly; you need to talk to the database. Going from the client to the Web tier to the database (a three-tier approach) instead of from an applet directly to a database (a two-tier approach) provides increased flexibility and security with little or no performance penalty. After all, the database call is usually the rate-limiting step, so going through the Web server does not slow things down. In fact, a three-tier approach is often faster because the middle tier can perform caching and connection pooling.In principle, servlets are not restricted to Web or application servers that handle HTTP requests but can be used for other types of servers as well. For example, servlets could be embedded in FTP or mail servers to extend their functionality. And, a servlet API for SIP (Session Initiation Protocol) servers was recently standardized (see /en/jsr/detail?id=116). In practice, however, this use of servlets has not caught on, and we'll only be discussing HTTP servlets.1.3 The Advantages of Servlets Over "Traditional" CGIJava servlets are more efficient, easier to use, more powerful, more portable, safer, and cheaper than traditional CGI and many alternative CGI-like technologies. 1.EfficientWith traditional CGI, a new process is started for each HTTP request. If the CGI program itself is relatively short, the overhead of starting the process can dominate the execution time. With servlets, the Java virtual machine stays running and handles each request with a lightweight Java thread, not a heavyweight operating system process. Similarly, in traditional CGI, if there are N requests to the same CGI program, the code for the CGI program is loaded into memory N times. With servlets, however, there would be N threads, but only a single copy of the servlet class would be loaded. This approach reduces server memory requirements and saves time by instantiating fewer objects. Finally, when a CGI program finishes handling a request, the program terminates. This approach makes it difficult to cache computations, keep database connections open, and perform other optimizations that rely on persistent data. Servlets, however, remain in memory even after they complete a response, so it is straightforward to store arbitrarily complex data between client requests. 2.ConvenientServlets have an extensive infrastructure for automatically parsing and decoding HTML form data, reading and setting HTTP headers, handling cookies, tracking sessions, and many other such high-level utilities. In CGI, you have to do much of this yourself. Besides, if you already know the Java programming language, why learn Perl too? You're already convinced that Java technology makes for more reliable and reusable code than does Visual Basic, VBScript, or C++. Why go back to those languages for server-side programming?3.PowerfulServlets support several capabilities that are difficult or impossible to accomplish with regular CGI. Servlets can talk directly to the Web server, whereas regular CGI programs cannot, at least not without using a server-specific API. Communicatingwith the Web server makes it easier to translate relative URLs into concrete path names, for instance. Multiple servlets can also share data, making it easy to implement database connection pooling and similar resource-sharing optimizations. Servlets can also maintain information from request to request, simplifying techniques like session tracking and caching of previous computations.4.PortableServlets are written in the Java programming language and follow a standard API. Servlets are supported directly or by a plugin on virtually every major Web server. Consequently, servlets written for, say, Macromedia JRun can run virtually unchanged on Apache Tomcat, Microsoft Internet Information Server (with a separate plugin), IBM WebSphere, iPlanet Enterprise Server, Oracle9i AS, or StarNine WebStar. They are part of the Java 2 Platform, Enterprise Edition, so industry support for servlets is becoming even more pervasive.5.InexpensiveA number of free or very inexpensive Web servers are good for development use or deployment of low- or medium-volume Web sites. Thus, with servlets and JSP you can start with a free or inexpensive server and migrate to more expensive servers with high-performance capabilities or advanced administration utilities only after your project meets initial success. This is in contrast to many of the other CGI alternatives, which require a significant initial investment for the purchase of a proprietary package.Price and portability are somewhat connected. For example, Marty tries to keep track of the countries of readers that send him questions by email. India was near the top of the list, probably #2 behind the U.S. Marty also taught one of his JSP and servlet training courses (see /) in Manila, and there was great interest in servlet and JSP technology there.Now, why are India and the Philippines both so interested? We surmise that the answer is twofold. First, both countries have large pools of well-educated software developers. Second, both countries have (or had, at that time) highly unfavorable currency exchange rates against the U.S. dollar. So, buying a special-purpose Webserver from a U.S. company consumed a large part of early project funds.But, with servlets and JSP, they could start with a free server: Apache Tomcat (either standalone, embedded in the regular Apache Web server, or embedded in Microsoft IIS). Once the project starts to become successful, they could move to a server like Caucho Resin that had higher performance and easier administration but that is not free. But none of their servlets or JSP pages have to be rewritten. If their project becomes even larger, they might want to move to a distributed (clustered) environment. No problem: they could move to Macromedia JRun Professional, which supports distributed applications (Web farms). Again, none of their servlets or JSP pages have to be rewritten. If the project becomes quite large and complex, they might want to use Enterprise JavaBeans (EJB) to encapsulate their business logic. So, they might switch to BEA WebLogic or Oracle9i AS. Again, none of their servlets or JSP pages have to be rewritten. Finally, if their project becomes even bigger, they might move it off of their Linux box and onto an IBM mainframe running IBM WebSphere. But once again, none of their servlets or JSP pages have to be rewritten.6.SecureOne of the main sources of vulnerabilities in traditional CGI stems from the fact that the programs are often executed by general-purpose operating system shells. So, the CGI programmer must be careful to filter out characters such as backquotes and semicolons that are treated specially by the shell. Implementing this precaution is harder than one might think, and weaknesses stemming from this problem are constantly being uncovered in widely used CGI libraries.A second source of problems is the fact that some CGI programs are processed by languages that do not automatically check array or string bounds. For example, in C and C++ it is perfectly legal to allocate a 100-element array and then write into the 999th "element," which is really some random part of program memory. So, programmers who forget to perform this check open up their system to deliberate or accidental buffer overflow attacks.Servlets suffer from neither of these problems. Even if a servlet executes a system call (e.g., with Runtime.exec or JNI) to invoke a program on the local operatingsystem, it does not use a shell to do so. And, of course, array bounds checking and other memory protection features are a central part of the Java programming language.7.MainstreamThere are a lot of good technologies out there. But if vendors don't support them and developers don't know how to use them, what good are they? Servlet and JSP technology is supported by servers from Apache, Oracle, IBM, Sybase, BEA, Macromedia, Caucho, Sun/iPlanet, New Atlanta, ATG, Fujitsu, Lutris, Silverstream, the World Wide Web Consortium (W3C), and many others. Several low-cost plugins add support to Microsoft IIS and Zeus as well. They run on Windows, Unix/Linux, MacOS, VMS, and IBM mainframe operating systems. They are the single most popular application of the Java programming language. They are arguably the most popular choice for developing medium to large Web applications. They are used by the airline industry (most United Airlines and Delta Airlines Web sites), e-commerce (), online banking (First USA Bank, Banco Popular de Puerto Rico), Web search engines/portals (), large financial sites (American Century Investments), and hundreds of other sites that you visit every day.Of course, popularity alone is no proof of good technology. Numerous counter-examples abound. But our point is that you are not experimenting with a new and unproven technology when you work with server-side Java.Servlet和JSP技术简述1.1 Servlet的功能Servlets是运行在Web或应用服务器上的Java程序,它是一个中间层,负责连接来自Web浏览器或其他HTTP客户程序的请求和HTTP服务器上的数据库或应用程序。

  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

(文档含英文原文和中文翻译)中英文对照外文翻译JSP技术Java Server Pages(JSP)是一种基于web的脚本编程技术,类似于网景公司的服务器端Java脚本语言—— server-side JavaScript(SSJS)和微软的Active Server Pages(ASP)。

与SSJS和ASP相比,JSP具有更好的可扩展性,并且它不专属于任何一家厂商或某一特定的Web服务器。

尽管JSP规范是由Sun公司制定的,但任何厂商都可以在自己的系统上实现JSP。

在Sun正式发布JSP(Java Server Pages)之后,这种新的Web应用开发技术很快引起了人们的关注。

JSP为创建高度动态的Web应用提供了一个独特的开发环境。

按照Sun的说法,JSP能够适应市场上包括Apache WebServer、IIS4.0在内的85%的服务器产品。

本文将介绍JSP相关的知识,以及JavaBean的相关内容,当然都是比较粗略的介绍其中的基本内容,仅仅起到抛砖引玉的作用,如果读者需要更详细的信息,请参考相应的JSP的书籍。

1.1 概述JSP(Java Server Pages)是由Sun Microsystems公司倡导、许多公司参与一起建立的一种动态网页技术标准,其在动态网页的建设中有其强大而特别的功能。

JSP与Microsoft的ASP技术非常相似。

两者都提供在HTML代码中混合某种程序代码、由语言引擎解释执行程序代码的能力。

下面我们简单的对它进行介绍。

JSP页面最终会转换成servlet。

因而,从根本上,JSP页面能够执行的任何任务都可以用servlet来完成。

然而,这种底层的等同性并不意味着servlet和JSP 页面对于所有的情况都等同适用。

问题不在于技术的能力,而是二者在便利性、生产率和可维护性上的不同。

毕竟,在特定平台上能够用Java编程语言完成的事情,同样可以用汇编语言来完成,但是选择哪种语言依旧十分重要。

和单独使用servlet相比,JSP提供下述好处:JSP中HTML的编写与维护更为简单。

JSP中可以使用常规的HTML:没有额外的反斜杠,没有额外的双引号,也没有暗含的Java语法。

能够使用标准的网站开发工具。

即使是那些对JSP一无所知的HTML工具,我们也可以使用,因为它们会忽略JSP标签(JSP tags)。

可以对开发团队进行划分。

Java程序员可以致力于动态代码。

Web开发人员可以将精力集中在表示层(presentation layer)上。

对于大型的项目,这种划分极为重要。

依据开发团队的大小,及项目的复杂程度,可以对静态HTML和动态内容进行弱分离(weaker separation)和强分离(stronger separation)。

此处的讨论并不是说人们应该放弃使用servlet而仅仅使用JSP。

事实上,几乎所有的项目都会同时用到这两种技术。

在某些项目中,更适宜选用servlet,而针对项目中的某些请求,我们可能会在MVC构架下组合使用这两项技术。

我们总是希望用适当的工具完成相对应的工作,仅仅是servlet并不一定能够胜任所有工作。

1.2 JSP的由来Sun公司的JSP技术,使Web页面开发人员可以使用HTML或者XML标识来设计和格式化最终页面。

使用JSP标识或者小脚本来生成页面上的动态内容(内容是根据请求来变化的)。

Java Servlet是JSP技术的基础,而且大型的Web应用程序的开发需要Java Servlet和JSP配合才能完成,Servlet这个名称源于Applet,现在国内的翻译方式很多,本书为了避免误会,决定直接采用Servlet而不做任何翻译,读者如果愿意,可以称之为“小服务程序”。

Servlet其实和传统的CGI、ISAPI、NSAPI等Web 程序开发工具的作用是相似的,在使用Java Servlet以后,用户不必再使用效率低下的CGI方式,也不必使用只能在某个固定Web服务器平台运行的API方式来动态生成Web页面。

许多Web服务器都支持Servlet,即使不直接支持Servlet的Web 服务器也可以通过附加的应用服务器和模块来支持Servlet。

得益于Java的跨平台的特性,Servlet也是平台无关的,实际上,只要符合Java Servlet规范,Servlet 是完全与平台无关且是与Web服务器无关的。

由于Java Servlet内部是以线程方式提供服务,不必对于每个请求都启动一个进程,并且利用多线程机制可以同时为多个请求服务,因此Java Servlet效率非常高。

但Java Servlet也不是没有缺点,和传统的CGI、ISAPI、NSAPI方式相同,Java Servlet是利用输出HTML语句来实现动态网页的,如果用Java Servlet来开发整个网站,动态部分和静态页面的整合过程会非常难以实现。

为了解决Java Servlet的这种缺点,SUN推出了JSP。

许多年前,Marty受到邀请,参加一个有关软件技术的小型研讨会.坐在Marty 旁边的人是James Gosling--- Java编程语言的发明者。

隔几个位置,是来自华盛顿一家大型软件公司的高级经理。

在讨论过程中,研讨会的主席提出了Jini的议题,这在当时是一项新的Java技术。

主席向该经理询问他的想法.他回答说,虽然现在言之过早,但这看起来会是非常有前途的一项技术。

他们会持续关注这项技术,如果这项技术变得流行起来,他们会遵循公司的“接受并扩充(embrace and extend)”的策略.此时, Gosling随意地插话说“你的意思其实就是不接受且不扩充(disgrace and distend)。

”在此, Gosling的抱怨显示出,他感到这个公司会从其他公司那里拿走技术,用于他们自己的目的.出人意料的是,形势已经完全不同。

Java团队并没有发明这一思想----将页面设计成由静态HTML和用特殊标签标记的动态代码混合组成.。

ColdFusion多年前就已经这样做了。

甚至ASP(来自于前述经理所在公司的一项产品)都在JSP出现之前推广了这种方式。

实际上,JSP不只采用了这种通用概念,它甚至使用许多和ASP相同的特殊标签。

JSP是建立在Java servlets模型之上的表达层技术,它使编写HTML变得更简单。

像SSJS一样,它也允许你将静态HTML内容与服务器端脚本混合起来生成动态输出。

JSP把Java作为默认的脚本语言,然而,就像ASP可以使用其他语言(如JavaScript和VBScript)一样,JSP规范也允许使用其他语言。

1.3 JSP的特点按照脚本语言是服务于某一个子系统的语言这种论述,JSP应当被看作是一种脚本语言。

然而,作为一种脚本语言,JSP又显得过于强大了,在JSP中几乎可以使用全部的Java类。

作为一种基于文本的、以显示为中心的开发技术,JSP提供了Java Servlet的所有好处,并且,当与一个JavaBeans类结合在一起时,JSP提供了一种使内容和显示逻辑分开的简单方式。

分开内容和显示逻辑的好处是,更新页面外观的人员不必懂得Java代码,而更新JavaBeans类的人员也不必是设计网页的行家里手,就可以用带JavaBeans类的JSP页面来定义Web模板,以建立一个由具有相似的外观的页面组成的网站。

JavaBeans类完成数据提供,这样在模板中就没有Java代码,这意味着这些模板可以由一个HTML编写人员来维护。

当然,也可以利用Java Servlet来控制网站的逻辑,通过Java Servlet调用JSP文件的方式来将网站的逻辑和内容分离。

一般来说,在实际的JSP引擎中,JSP页面在执行时是编译式,而不是解释式的。

解释式的动态网页开发工具如ASP、PHP3等由于速度等原因已经满足不了当前大型电子商务应用的需要了,传统的开发技术都在向编译执行的方式改变,如ASP →ASP+;PHP3→PHP4。

在JSP规范书中,并没有明确要求JSP中的程序代码部分(称为Scriptlet)一定要用Java来写。

实际上,有一些JSP引擎就是采用的其他脚本语言,如EMAC-Script、WebL等,但实际上这几种脚本语言也是构建在Java上面,编译为Servlet来实现的。

按照JSP规范书写,和Java没有任何关系的Scriptlet也是可以的,不过,由于JSP的强大功能主要在于能和JavaBeans、Enterprise JavaBeans 共同运转,所以即使是Scriptlet部分不使用Java,编译成的执行代码也应该是与Java相关的。

1.4 JSP的机制要理解JSP怎样联合以上各种所提到的技术的优点,从而轻而易举地实现各种效果,用户必须首先了解“组件为中心的网页开发”和“页面为中心的网页开发”的区别。

都SSJS和ASP都是在几年前推出的,那时网络还很年轻,没有人知道除了把所有的商务、数据和表达逻辑统统堆进原始网页中之外还有什么更好的解决方法。

这种以页面为中心的模型容易学习并且得到相当快速的发展。

然而,随着时间的推移,人们认识到这种方法不适于构建大型的、可升级的Web应用程序。

在脚本环境中书写的表达逻辑被锁在页面内,只有通过剪切和粘贴才能被重用。

表达逻辑通常和商务及数据逻辑混在一起,这使得当程序员试图改变一个应用程序的外观而不想破坏与之紧密结合的商务逻辑时,应用程序的维护就变得十分艰难。

其事实上,企业中可重用组件的应用早已经很成熟,没有人愿意为它们的应用程序重写那些逻辑。

HTML和图形设计师把它们的设计的实施工作交给了Web编写者,使他们不得不加倍工作——常常是手工编写,因为没有合适的工具可以把服务器端脚本与HTML 内容结合起来。

简而言之,随着Web应用程序的复杂性不断提升,以页面为中心的开发方式的局限性变得明显起来。

与此同时,人们一直在寻找建立Web应用程序的更好方法,组件在客户机/服务器领域流行起来。

JavaBeans和ActiveX被“快速应用程序开发”(RAD)工具发行商推广给Java和Windows应用程序开发者用来快速开发复杂的程序。

这些技术使某领域内的专家可以为本领域内的垂直应用编写组件,而开发者可以直接拿来使用而不必掌握这一领域的专门技术。

作为一种以组件为中心的开发平台,JSP出现了。

它以JavaBeans和Enterprise JavaBeans(EJB)组件包含商务和数据逻辑的模型为基础,提供大量标签和一个脚本平台用来在HTML页中显示由JavaBeans产生或回送的内容。

由于JSP的以组件为中心的性质,它可以被Java和非Java开发者同样使用。

非Java开发者可以通过JSP的标签(Tags)来使用高级Java开发者创建的JavaBeans。

相关文档
最新文档