jsp技术网站设计外文翻译
JSP技术简介
第1章JSP技术简介JSP(Java Server Pages)技术是由Sun公司发布的用于开发动态Web应用的一项技术。
它以其简单易学、跨平台的特性,在众多动态Web应用程序设计语言中异军突起,在短短几年中已经形成了一套完整的规范,并广泛地应用于电子商务等各个领域中。
在国内,JSP 现在也得到了比较广泛的重视,得到了很好的发展,越来越多的动态网站开始采用JSP技术。
本章就对JSP及其相关技术进行简单的介绍。
1.1 认识HTTP协议HTTP协议(Hypertext Transfer Protocol,超文本传送协议)是WWW服务器使用的主要协议,对HTTP协议细节的基本理解是编写JSP或Java小程序的开发人员所必需的。
因此在学习JSP技术之前有必要更加仔细地研究一下HTTP消息的格式(这里的讨论源自HTTP/1.1协议规范。
参见规范2616,网址为/rfc/rfc2616.txt)。
HTTP 协议的关键部分有HTTP请求和HTTP响应,以及客户端Web程序设计的一些基础知识,在第4章4.4节将会具体介绍。
1.2 客户端Web程序设计介绍Web浏览器现已成为深受大多数用户喜爱的用户界面。
HTML语言提供了丰富的控件,第三方厂商提供了Visual Basic编写的数百个额外的控件,这些都使得Web浏览器独具特色。
虽然Web浏览器与传统的GUI界面有一定的差距,但它提供了一种独立而又简单的方法来访问分布式资源,尤其是Internet资源。
而且越来越多的客户端Web程序扩展技术变得更加成熟,出现了包括CSS、JavaScript、VBScript、动态HTML、Java1.1.Applet应用程序等技术在内的客户端Web程序设计技术,它们的相互结合使得Web程序更加迷人。
下面简单介绍几种常用的客户端Web程序设计技术的特点。
本书假定读者对这些技术都有一定的了解,不对这些技术作详细介绍。
1.2.1 CSSCSS(Cascading Style Sheets)称为层叠样式表,是动态HTML技术的一个部分,但可以和HTML结合使用。
jsp技术网站设计外文翻译--将Servlet和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 / doP ost / 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动态网站技术
附录3 J SP dynamic web technologyJSP (JavaServer Pages) is initiated by Sun Microsystems, Inc., with many companies to participate in the establishment of a dynamic web page technical standards. JSP technology somewhat similar to ASP technology, it is in the traditional HTML pages in the document paragraph inserted JAVA procedures (Scriptlet) and JSP tag (tag), thus JSP documents. Using JSP development of the Web application is cross-platform that can run on Linux, is also available for other operating systems.JSP technology to use the Java programming language prepared by the category of XML tags and scriptlets, to produce dynamic pages package processing logic. Page also visit by tags and scriptlets exist in the services side of the resources of logic. JSP page logic and web page design and display separation, support reusable component-based design, Web-based application development is rapid and easy.Web server in the face of visits JSP page request, the first implementation of the procedures of, and then together with the results of the implementation of JSP documents in HTML code with the return to the customer. Insert the Java programming operation of the database can be re-oriented websites, in order to achieve the establishment of dynamic pages needed to function. JSP and Java Servlet, is in the implementation of the server, usually returned to the client is an HTML text, as long as the client browser will be able to visit.JSP 1.0 specification of the final version is launched in September 1999, December has introduced 1.1 specifications. At present relatively new is JSP1.2 norms, JSP2.0 norms of the draft has also been introduced. JSP pages from HTML code and Java code embedded in one of the components. The server was in the pages of client requests after the Java code and then will generate the HTML pages to return to the client browser. Java Servlet JSP is the technical foundation and large-scale Web application development needs of Java Servlet and JSP support to complete. JSP with the Java technology easy to use, fully object-oriented, and a platform-independent and secure, mainly for all the characteristics of the Internet.JSP dynamic web site development and technology.Early dynamic web site development and technology using a CGI-BIN interface. Developers to write interfaces with the relevant procedures and a separate Web-based applications, the latter through the Web server to call the former. This development technology there is a serious expansion of the problem - each new CGI procedural requirements on the server add a new process. If multiple users with access to the program, these processes will run out of the Web server all the resources available, until its collapse. In order to overcome the disadvantages of the proposed Microsoft Active Server Pages (ASP) technology, which use the "plug-in" and API simplifies Web application development. CGI and ASP compared to its advantages can include HTML tags, can directly access the database and the use of unlimited expansion of the ActiveX control, so the procedure on the preparation of a more flexible. But the technology is basically limited to Microsoft operating system platform, the main work environment is Microsoft's IIS application structure, the ASP technology can not easily achieve cross-platform Web server program development.Hypertext Preprocessor (Hypertext Pre-processor), PHP dynamic web site development and technology similar to ASP, is also a kind of embedded in HTML document server-side scripting language. Most of its grammar and C, Java, Perl, and other similar language and formed its own unique style, use of the language Web programmers can quickly develop dynamic pages. PHP in most Unix platforms, GUN / Linux and Microsoft Windows platform can run. PHP's main advantages are: ease of installation, the learning process simple database connection convenience, compatibility strong expansion of the strong can object-oriented programming, and so on. However, PHP, there are some weaknesses, mainly PHP is an interpretation of language, not to support multi-threaded structure, the support platform and database connections are limited, especially in support of the standards with regard to inherent weaknesses, for some e-commerce applications , PHP is not appropriate.There are also technologies such as Java Servlets technology, make use of the technology can be easily prepared using the Java language interactive server-side code. A Java Servlets is a Java-based technology running on the server-side program (and Applet different, the latter running in the browser). Developers to write such a Java Servlets, to receive from the Webbrowser's HTTP request, to generate a dynamic response (may need to query the database to complete such a request), then send HTML or XML documents response to the browser. The technology for ordinary pages designers to easily grasp it is very difficult. This approach, the entire page in the Java Servlets are to be created. If the developers or managers want to adjust Web pages that have to edit and re-build the Java Servlets.Sun Microsystems (Sun Microsystems Inc.) In Web servers, application servers, the trading system and development tools provider of broad support and cooperation, integration and balance already exists in the Java programming environment (such as Java Servlets and JavaBeans) To support the technology and tools have a new, Web-based application development methods - JavaServer Pages Technology (JSP). This dynamic web site development and technology mainly have the following characteristics:To any Web or application server running on; From the application of logic and display pages; To carry out the rapid development and testing; Simplifies the development of Web-based interactive applications for the process. JSP technology methods In order to facilitate the rapid and dynamic development of the site, JSP in the following areas made improvements, making it a rapid establishment of cross-platform dynamic site's preferred option.1.Will generate and display the contents of separationUsing JSP technology, Web pages and developers can use HTML or XML logo design and formatting the final pages, and use the JSP logo or legs had generated dynamic content on the page (the content is based on changes in the request, for example, request account informationA bottle of wine or a specific price, etc.). Content generated by the logic of the logo andpackaging JavaBeans components, and tied up in the script, all of the scripts in the server-side run. As the core logic in the logo and packaging was in the JavaBeans, Web page designers and management personnel, will be able to edit and use JSP pages and will not affect the content generated.In the server, JSP engine explained JSP logo and script, generated by the content of the request (for example, by visiting JavaBeans components, the use of JDBC to access the database or contain), and will result in HTML (or XML) pages in the form of sending Back to the browser.This helps to protect themselves from the code, can guarantee that any HTML-based Web browser's complete availability.2. Reusable componentsThe vast majority of JSP pages rely on reusable, cross-platform components (JavaBeans or Enterprise JavaBeans components) to implement the procedures required by the application of the complexity of treatment. Developers to share and exchange the implementation of the general operation of the components, or make these components for more users and groups used by the customer. Component-based methods to accelerate the overall development process and enable organizations of all kinds in their existing skills and optimize the results of development efforts in the balance.3. Use of logoWeb page developers are not familiar with the scripting language programmers. JSP technology package has many functions, which is in easy-to-use, XML and JSP related to the identification of dynamic content generation needs. JSP standard logo to access and examples of JavaBeans components, component attribute set or retrieve, download Applet, and the implementation of other methods more difficult to coding and time-consuming function.4. Adaptation platformAlmost all platforms support Java, JSP + JavaBeans almost all platforms unimpeded access. From a port to another platform, JSP and JavaBeans do not even have to recompile, because Java byte code standards and are platform-independent.5. Database connectionJava in the database linking the technology is JDBC, Java program through JDBC driver and database linked to the implementation of enquiries, such as data extraction operation. Sun has also developed a JDBC-ODBC bridge, use of this technology with Java programs can access the database ODBC driver, the majority of database systems come with ODBC driver.In addition, through the development of the logo, JSP technology can be further expanded. Third-party developers and other personnel for the common functions can create their own logo for. This makes Web page developers can use familiar tools and the same logo as theimplementation of specific features of the component to their work.JSP technology easily integrated into a variety of applications in architecture, to use the existing tools and skills, and be extended to support enterprise-class distributed applications. Use of Java technology as part of the family, and the Java 2 (Enterprise Architecture) an integral part of, JSP technology can support the highly complex Web-based applications.JSP pages because of the built-in scripting language is based on Java, and all of the JSP pages have been compiled into Java Servlets, so JSP pages with all the benefits of Java technology, including robust storage management and security. As part of the Java platform, JSP with the Java programming language, "a preparation, the entire operation" characteristics.JSP application of the model.JSP pages usually been compiled into Java Servlets, this is a standard Java extension. Pages developers to visit all of the Java application environment, to take advantage of Java technology and the expansion of portability. This makes the next page of the call, the server will be very quick response (which avoids the CGI-BIN for each HTTP request to generate a new process).JSP pages can contain a variety of different applications in architecture or model, can be used by different agreements, parts and components by the format of the Commonwealth. Based on the dynamic information dissemination and JSP technology is an open, scalable create dynamic Web pages standards. Regardless of what used to create tools, developers can use JSP pages to create a portable Web applications, in different Web server applications to run on.JSP动态网站技术:JSP(JavaServer Pages)是由Sun Microsystems公司倡导、许多公司参与一起建立的一种动态网页技术标准。
网页设计专业毕业设计外文翻译
Produce the design of the tool and realize automaticallyon the basis of JSP webpageIt is an important respect that Internet uses that Web develops technology, and JSP is the most advanced technology that Web is developed , it is present Web developer's first-selected technology. But because JSP has relatively high expectations for Web developer, a lot of general Web developers can not use this advanced technology . The discussion produces the design of the tool and realizes automatically on the basis of JSP webpage of the template and label storehouse, put forward concrete design philosophy and implementation method .With the popularization of WWW (World Wide Web ), the technology of the dynamic webpage is developed rapidly too. From original CGI (Common Gateway In-terface ) to ASP (Active Server Page ), have met the webpage developer to the demand for developing technology of the dynamic webpage to a certain extent. But no matter CGI or ASP have certain limitation, for instance, consuming to resources of the server of CGI, ASP can only be used etc. with Microsoft IIS, all these have limited scope of application of the technology, have hindered their popularization greatly. The vast page developers all look forward to a kind of unified page and develop technology earnestly, characteristic that this technology there should be:①Have nothing to do with the operating platform, can run on any Web or the application program server ;②Show the logic and page of application program that separates ; ③Offer codes to put in an position, simplify and develop the course based on interactive application program of Web.JSP (Java Server Page ) technology is designed and used for responding to the request that like this. JSP is developed technology by the new webpage that Sun MicroSystem Company put out in June of 1999, it is that Web based on Java Serv-let and the whole Java system develops technology, and Servlet2. Expansion of 1API. Utilize this technology, can set up advancedly , safely and stepping dynamic websites of the platform .Java is the future mainstream to develop technology , have a lot of advantages . JSP is Java important application technology on Internet/Intranet Web , get extensive support and admit, it can conbine with various kinds of Java technology together intactly , thus realize very complicated application.As a kind of technology of development based on text , taking showing as centre, JSP has offered all advantages of Java Servlet. Logic function in order to make sure and showing the function was separated , JSP can already work with JavaBeans , Enterprise JavaBeans (EJB ) and Servlet . The developer of JSP can finish the work that majority and website's logic are correlated with through using JavaBeans , EJB and Servlet , and only assign the work shown to JSP page to finish. Content and show advantage that logic separate lie in , upgrade person , page of appearanceneedn't understand Java code , the personnel upgrading Javas needn't be experts who design webpage either. This can define Web template in JSP page with Javas , in order to set up websites made up of a page with similar appearance. Java completion data offer, have Java code among template, this mean template these can write by one HTML person is it maintain to come.JSP develops technology as the webpage of the mainstream at present, has the following characteristics:(1) Separate the formulation and showing of the content : Using JSP technology, the page developer of Web can use HTML or XML identification to design and format the final page . Use JSP identification or bound foot turn into dynamic content of page actually (whether content according to is it come change to ask). Produce logic of content of the identification and JavaBeans package , truss up of the little script encapsulation, all scripts run in the end of the server. If key logic among identification and JavaBeans, then other people, such as Web administrative staff and page designer encapsulation, can edit and use JSP page , and does not influence the formulation of the content .(2) Emphasize the reusable package : Most JSP pages depend on the reusable one, the package stepping the platform finish more complicated treatment with required application program. Benefitting from the independence of operating platform of Java, the developer can be very convenient to share and exchange and carry out the ordinary package that operated, or make these packages used by more users. The method based on package has accelerated the total development course, the efficiency of improving the project and developing wholly greatly.Though JSP is powerful, it requires the webpage developer should be quite familiar with Java. There are still relatively few Java programmers now, for general webpage developer, the grammar of JSP is more difficult to grasp . So, need a kind of webpage developing instrument and offer commonly used JSP application to general webpage developer, is it understand general page develop developer of technology (HTML ) can use strong function of JSP too only to let.Systematic design object and main technology of use:(1)Design objectSystem this design object for understand but HTML understand general webpage developer of JSP offer a webpage developing instrument at all only, enable them to follow the systematic file, use the daily function of JSP through the label, produce one finally and only include static HTML and dynamic JSP webpage of JSP label.(2)Main technologyThis system is in the design, consider using the technology of the template and JSP label to realize mainly.1、Technology of the templateThe technology of the template is widely applied to various kinds of development and application system. It produces some commonly used frame structure in advance , uses the family to choose the template from the template storehouse conveniently according to the needs of one's own one, is it is it put up to go again by oneself to need , save construction period in user , facilitate use of user. In this system , classify the page according to the function type , sum up the commonly used page type, produce the template storehouse.2、Storehouse technology of the labelIn JSP, movements can create and visit the language target of the procedure and influence the element exported and flowed. JSP has defined six standard movements. Except six standard movement these, user can define own movement finish the specific function. These movements are known as the customer movement, they are the reusable procedure module . Through movement these, programmer can some encapsulation stand up too display function of page in JSP page, make the whole page more succinct and easier to maintain. In a JSP page, movements were transfered through the customer label in these customers. And the label storehouse (Tag Library ) is the set of the customer label.JSP label storehouse is that one kind produces the method based on script of XML through JavaBeans. It is one of the greatest characteristics of JSP. Through the label storehouse , can expand JSP application unrestrictedly , finish any complicated application demand.JSP label storehouse has the following characteristic:①Easy to use: The labels in JSP and general HTML marks are totally the same in appearance, it is as convenient as ordinary HTML mark to use.②The easy code is paid most attention to: Every label in the label storehouse can finish certain function . Define ready to eat one label storehouse , is it pack one Jar file the label storehouse to need only, then only need use this label storehouse in other systems afterwards, needn't develop codes again , has raised the system and developed efficiency greatly, have reduced the development cost.③The easy code is safeguarded: All application logic is encapsulated in label processor and JavaBeans, all labels concentrate on a label storehouse. If need to upgrade codes or need to revise the function on a webpage, only need to revise the corresponding label. Maintain way in unison through this kind , it is unnecessary in each webpage is it is it fix to act as to get onning, have reduce the work load safeguarded greatly, has economized the cost of safeguarding.④The easy system is expanded : If need to add the new function to the system , only need to define a new label to finish this function, do not need to do any change to other respects of thesystem. Can inherit JSP normal characteristics of various fields in the label storehouse. Can expand and increase the function of JSP unrestrictedly like this, and does not need to wait for the appearance of the next edition JSP .Systematic composition and realizing:(1)The system making upThis system is made up of four parts mainly:1、The database joins some: This system supports several daily databases , including Oracle, Sybase, MSSQLServer, MySQL and DB2, use JDBC and database to link to each other according to database type and database name , user name , password that users offer that users choose.2、The basic form of system produces some: After joining with the database , produce the basic form TC-Tables and TC-Columns of two systems according to the user name linking to each other with the database , TC-Tables form includes English name , Chinese name and some attribute of form belonging to this user in this database , for instance can revise , can inquire about ; The Chinese and English name of the row and some other attribute that TC-Columns form includes belonging to all forms of this user's in this database . For instance can show , can inquire about . Basic information of the database that these basic forms of two systems provide to user's institute for use in the course of development of the whole system.3、The template is chosen to produce some with the webpage: This part is a key part of a system. It includes two pieces of sub module .①The template is chosen some: The system offers the template to user and chooses the interface, let users choose the templates used from the template storehouse according to the need.②The template is dealt with some: According to template that user choose, system transfer designated template deal with module is it punish to go on to these template. When dealing with the label that the procedure meets in the template, offer the mutual interface to user, let user input parameter for designated label , prove system validity of label that user input. Finished the formulation of JSP page systematically finally.Webpage preview is with revising some: After the webpage was produced out, the system has offered a webpage preview window and code to user and looked over that revises the window. Through this preview window, users can look at the result of JSP page produced out in advance . If user static result of respect in page very satisfied, user can through code look over revise window revise HTML code of code. If users have further demands for the static result of the page, the system has also offered a piece of interface which transfers DreamWeaver editing machine to user, users can use it to carry on further modification and perfection to the static result of JSP page that is produced out .(2)Systematic realization1、Realization of the template storehouse and label storehouseThe planning and design of the label storehouse are essential in the whole system design, efficiency that the degree and system that are put in an position have operated that its relation has reached codes. Its planning should follow the following principle .(1) Should try one's best little including static HTML among label. To general user, the label is transparent. Users can not look over and revise labels . If include too many static HT-ML sentence in the label , will influence the modification and perfection of user's static result to the page, limit the use of the label.(2) Try one's best to raise the paying most attention to degree of the code. Is it is it is it is it is it is it get to JSP public JSP out to withdraw to use to try one's best to classify to go on to use, form labels. Do not use and realize this application repeatedly in each label . While revising and perfecting to using like this , only need to revise this label, maintenance of the easy code.(3) Facilitate users' use. While designing the label storehouse , should fully consider users' operating position , it can very easy and understanding and using labels conveniently to use the family.①Definition of the label storehouse: Define a label storehouse, must define a label storehouse and describe the file (TLD ) at first . This is a file of script based on XML, have defined the edition of XML in this file , codes used, the edition , name and definition and parameter of all labels included in this storehouse of the label storehouse of the edition of the label storehouse , JSP used describe, including the name of the label, corresponding Javas of label, description information of the label ,etc..②Realization of the label: One label first special Java type, this each must inherit TagSupports , this each is in javax. servlet. jsp. Define in tagext bag . In the labels, the parameter which includes this label initializes the subject treatment method (Handler ) of method (Set/Get ) , label and method available for making the first class label to adjust,etc..③Realization of the template : A template is that one contains JSP file that labels quoted . In order to quote the labels defined in the template , must introduce the label storehouse at first .<%@taglib uri=“tag.tld”prefix=“ctag”%>Among them uri appoints the label storehouse to describe the route of the file ; Prefixes used when prefix appoints to quote labels.While quoting the designated label in the template , use the designated prefix while introducing the label storehouse, appoint the name of the label; It is the parameter assignment of the label.2、Systematic development environmentWhat this systematic subject procedure making is used is JBuilder 6 of Borland Company. 0, it is Front-Page2000 of Microsoft Company that the template is developed and used, what the label storehouse is developed and used is UltraEdit editing machine, what JDK is adopted is JDK1.4. The system testing environment is JRun3. 0.Java future mainstream to develop language, and Java using JSP will become major technology that Web will be developed in the future too mainly at Web. This system has adopted the label storehouse , one of the biggest characteristics of JSP, enable the general Web developer to use JSP strong dynamic page function conveniently too, develop JSP dynamic Web page of the modern techniques. Because this system adopts Java to develop, can run under the operating system of any support graphic interface , have realized complete having nothing to do with the platform. This system is easy to expand and perfect. Can consider offering the interface to user afterwards , will use the family to expand the template storehouse and label storehouse by oneself, strengthen the systematic function further.List of references:[1] Cay S. Horstmann,Gary Cornell. Java 2 key technology (CoreJava 2 ) [M ]. Beijing: Publishing house of the mechanical industry.[2] Bruce Eckel. Java programming thought (Thinking in Java ) [M ]. Beijing: Publishing house of the mechanical industry.[3] Joseph L. Weber. Java 2 programming is explained in detail (Using Java 2) [M ]. Beijing: Electronic Industry Press.[4] Borland Company. Building Applications with JBuilder.基于JSP网页自动生成工具的设计与实现Web开发技术是Internet应用的一个重要方面,而JSP又是Web开发的最先进的技术,是当前Web开发人员的首选技术。
JSP技术外文翻译
翻译资料原文Overview of JSP TechnologyBenefits 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 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.Advantages 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 avery 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 the bandwagon. In fact, JSP not only adopted the general idea, it even used many of the same special tags as ASP did.So, the question 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 twofold.First, 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 forthe dynamic code. With JSP, the dynamic part is written in Java, not VBScript or anotherASP-specific language, so JSP is more powerful and better suited to complex applications that require reusable components.You 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 programming.3. 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 arebetter 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 releases.However, 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 elements.10.4 Misconceptions About JSPForgetting 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 no t 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 puttin g 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 image 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 th e 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 anything to prevent clients from seeing JSP tags; those tags areprocessed 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.• Loading into memory, initialization, and execution follow the normal rules for servlets.Table 1 gives some common scenarios and tells whether or not each step occurs in that scenario. The most frequently misunderstood entries are highlighted. When referring to the table, note that servlets resulting from JSP pages use the _jspService method (called for both GET and POST requests), not doGet or doPost. Also, for initialization, they use the jspInit method, not the init method.Table 1. JSP Operations in Various ScenariosJSP page translated into servlet Servlet compiled Servlet loaded into server's memory jspInit called _jspService calledPage first writtenRequest 1 Yes Yes Yes Yes YesRequest 2 No No No No YesServer restartedRequest 3 No No Yes Yes YesRequest 4 No No No No YesPage modifiedRequest 5 Yes Yes Yes Yes YesRequest 6 No No No No Yes翻译资料译文JSP技术概述一、JSP的好处JSP页面最终会转换成servler。
计算机外文翻译---JSP应用框架
外文翻译原文及译文JSP application frameworksWhat are application frameworks:A framework is a reusable, semi-complete application that can be specialized toproduce 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 componentsas 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 providecomponent.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 theInternet 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 locationof 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 the s even 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 andvideos. 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.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 CGIconventional 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:out.println("<P>One line of HTML.</P>");out.println("<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 stat e 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 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.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 Reflec tion 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.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 0.92 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. Awith 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.Now that you have had a taste of what it is like to develop a web application with Struts, in chapter 2 we dig deeper into the theory and practice behind the Struts architecture.JSP 应用框架什么是应用框架:框架(framework)是可重用的,半成品的应用程序,可以用来产生专门的定制程序。
计算机专业毕业设计外文翻译--JSP内置对象
附录1 外文参考文献(译文)JSP内置对象有些对象不用声明就可以在JSP页面的Java程序片和表达式部分使用,这就是JSP 的内置对象。
JSP的内置对象有:request、response、session、application、out.response和request对象是JSP内置对象中较重要的两个,这两个对象提供了对服务器和浏览器通信方法的控制。
直接讨论这两个对象前,要先对HTTP协议—Word Wide Wed底层协议做简单介绍。
Word Wide Wed是怎样运行的呢?在浏览器上键入一个正确的网址后,若一切顺利,网页就出现了。
使用浏览器从网站获取HTML页面时,实际在使用超文本传输协议。
HTTP规定了信息在Internet上的传输方法,特别是规定吧浏览器与服务器的交互方法。
从网站获取页面时,浏览器在网站上打开了一个对网络服务器的连接,并发出请求。
服务器收到请求后回应,所以HTTP协议的核心就是“请求和响应”。
一个典型的请求通常包含许多头,称作请求的HTTP头。
头提供了关于信息体的附加信息及请求的来源。
其中有些头是标准的,有些和特定的浏览器有关。
一个请求还可能包含信息体,例如,信息体可包含HTML表单的内容。
在HTML表单上单击Submit 键时,该表单使用ACTION=”POST”或ACTION=”GET”方法,输入表单的内容都被发送到服务器上。
该表单内容就由POST方法或GET方法在请求的信息体中发送。
服务器发送请求时,返回HTTP响应。
响应也有某种结构,每个响应都由状态行开始,可以包含几个头及可能的信息体,称为响应的HTTP头和响应信息体,这些头和信息体由服务器发送给客户的浏览器,信息体就是客户请求的网页的运行结果,对于JSP 页面,就是网页的静态信息。
用户可能已经熟悉状态行,状态行说明了正在使用的协议、状态代码及文本信息。
例如,若服务器请求出错,则状态行返回错误及对错误描述,比如HTTP/1.1 404 Object Not Found。
Servlet和JSP技术简介中英文资料外文翻译文献
Servlet和JSP中英文资料外文翻译文献An Overview of Servlet and JSP Technology Marty Hall and Larry Brown,2000-07, Core Servlets and JavaServer Pages chapter 11.1A 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 in a 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 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.2Why 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 request headers). 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 handleHTTP 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.3The 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 andreusable 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. Communicating with 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 (J2EE; see /j2ee/), 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 Web server 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 isharder 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 operating system, 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. Numerouscounter-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 程序运行在服务器端,在动态的生成Web页面方面与传统的CGI 和许多其他的类似CGI技术相比,Java Servlet更高效,更容易使用,功能更强大,并且拥有更好的可移植性,更节省投资。
基于JSP的文档共享与交流平台毕业设计外文翻译、开题报告、文献综述
本科毕业设计任务书基于JSP的文档共享与交流平台设计与实现院(系、部)名称:工商管理学院专业名称:信息管理与信息系统学生姓名:学生学号:指导教师:2012年 5月 18日指导教师签名:教学部主任审查签名:本科毕业设计开题报告基于JSP的文档共享与交流平台设计与实现院(系、部)名称:工商管理学院专业名称:信息管理与信息系统本科毕业设计中期检查表本科毕业设计答辩记录表本科毕业设计成绩评定汇总表本科毕业设计工作总结基于JSP的文档共享与交流平台设计与实现院(系、部)名称:工商管理学院专业名称:信息管理与信息系统本科毕业设计文献综述基于JSP的文档共享与交流平台设计与实现院(系、部)名称:工商管理学院专业名称:信息管理与信息系统1选题背景和意义1.1选题背景随着科技的进步和全社会信息化程度的进一步加深,越来越多的人开始通过网络来了解和获得各种自己需要的信息,特别是一些专业人员对自己专业信息的需要。
在素质教育与终身教育成为必然的今天,人们对信息的需求有了更新,更高的要求,而基于WEB的信息平台由于本身所具有的信息量大,传递快速,没有时空限制等特点恰好满足这种要求。
整个社会的信息化进程不断加速,信息数字化旋风席卷全球,数字化资源已逐渐成为整个信息社会的核心资源之一。
特别是在最近的几十年中,数字技术和网络技术在各个领域的应用启发人们开始在文档资源的数字化使用、传播和保存方面的探索,发展趋势良好并取得一些阶段性的成果,文档资源的数字化共享已经成为大众所关注的重要领域之一[1]。
传统的纸质文档成本高,不利于保存,不利于查找、共享等方面的缺点,催生了人们寻求更简单、方便、快捷的保存文档的方法,为此建立一个基于JSP的文档共享管理平台,以满足人们对信息的需求。
多用户文档管理系统提供强大的全文检索功能以提高检索效率和准确性、灵活方便的权限管理提升文档的共享作用。
充分发挥信息共享的威力,提升办公效率。
1.2选题的意义近年来,随着我国信息化的发展,科技事业已经迈入了一个全新的历史发展时期。
网站毕业设计外文翻译
WebsiteFrom Wikipedia, the free encyclopediaA website is a collection of related web pages, images, videos or other digital assets that are addressed relative to a common Uniform Resource Locator (URL), often consisting of only the domain name, or the IP address, and the root path in an Internet Protocol-based network. A web site is hosted on at least one web server, accessible via a network such as the Internet or a private local area network.A web page is a document, typically written in plain text interspersed with formatting instructions of Hypertext Markup Language (HTML, XHTML).A web page may incorporate elements from other websites with suitable markup anchors.Web pages are accessed and transported with the Hypertext Transfer Protocol (HTTP), which may optionally employ encryption (HTTP Secure, HTTPS) to provide security and privacy for the user of the web page content. The user's application, often a web browser, renders the page content according to its HTML markup instructions onto a display terminal.All publicly accessible websites collectively constitute the World Wide Web.the pages of a website can usually be accessed from a simple Uniform Resource Locator called the homepage. The URLs of the pages organize them into a hierarchy, although hyperlinking between them conveys the reader's perceived site structure and guides the reader's navigation of the site.Some websites require a subscription to access some or all of their content. Examples of subscription sites include many business sites, parts of many news sites, academic journal sites, gaming sites, message boards, web-based e-mail, social networking websites, and sites providing real-time stock market data.1.HistoryThe World Wide Web (WWW) was created in 1989 by CERN physicist Tim Berners-Lee.On 30 April 1993, CERN announced that the World Wide Web would be free to use for anyone.Before the introduction of HTML and HTTP, other protocols such as filetransfer protocol and the gopher protocol were used to retrieve individual files from a server. These protocols offer a simple directory structure which the user navigates and chooses files to download. Documents were most often presented as plain text files without formatting or were encoded in word processor formats.2.OverviewOrganized by function, a website may be(1)a personal website(2)a commercial website(3)a government website(4)a non-profit organization websiteIt could be the work of an individual, a business or other organization, and is typically dedicated to some particular topic or purpose. Any website can contain a hyperlink to any other website, so the distinction between individual sites, as perceived by the user, may sometimes be blurred.Websites are written in, or dynamically converted to HTML (Hyper Text Markup Language) and are accessed using a software interface classified as a user agent. Web pages can be viewed or otherwise accessed from a range of computer-based and Internet-enabled devices of various sizes, including desktop computers, laptops, PDAs and cell phones.A website is hosted on a computer system known as a web server, also called an HTTP server, and these terms can also refer to the software that runs on these systems and that retrieves and delivers the web pages in response to requests from the website users. Apache is the most commonly used web server software (according to Netcraft statistics) and Microsoft's Internet Information Server (IIS) is also commonly used.3. Static websiteA static website is one that has web pages stored on the server in the format that is sent to a client web browser. It is primarily coded in Hypertext Markup Language (HTML).Simple forms or marketing examples of websites, such as classic website, a five-page website or a brochure website are often static websites, because they present pre-defined, static information to the user. This may includeinformation about a company and its products and services via text, photos, animations, audio/video and interactive menus and navigation.This type of website usually displays the same information to all visitors. Similar to handing out a printed brochure to customers or clients, a static website will generally provide consistent, standard information for an extended period of time. Although the website owner may make updates periodically, it is a manual process to edit the text, photos and other content and may require basic website design skills and software.In summary, visitors are not able to control what information they receive via a static website, and must instead settle for whatever content the website owner has decided to offer at that time.They are edited using four broad categories of software:(1) Text editors, such as Notepad or TextEdit, where content and HTML markup are manipulated directly within the editor program(2) Wysiwyg offline editors, such as Microsoft FrontPage and Adobe Dreamweaver (previously Macromedia Dreamweaver), with which the site is edited using a GUI interface and the final HTML markup is generated automatically by the editor software(3) Wysiwyg online editors which create media rich online presentation like web pages, widgets, intro, blogs, and other documents.(4) Template-based editors, such as Rapidweaver and iWeb, which allow users to quickly create and upload web pages to a web server without detailed HTML knowledge, as they pick a suitable template from a palette and add pictures and text to it in a desktop publishing fashion without direct manipulation of HTML code.4. Dynamic websiteA dynamic website is one that changes or customizes itself frequently and automatically, based on certain criteria.Dynamic websites can have two types of dynamic activity: Code and Content. Dynamic code is invisible or behind the scenes and dynamic content is visible or fully displayed.(1) Dynamic codeThe first type is a web page with dynamic code. The code is constructed dynamically on the fly using active programming language instead of plain,static HTML.A website with dynamic code refers to its construction or how it is built, and more specifically refers to the code used to create a single web page. A dynamic web page is generated on the fly by piecing together certain blocks of code, procedures or routines. A dynamically-generated web page would call various bits of information from a database and put them together in a pre-defined format to present the reader with a coherent page. It interacts with users in a variety of ways including by reading cookies recognizing users' previous history, session variables, server side variables etc., or by using direct interaction (form elements, mouse overs, etc.). A site can display the current state of a dialogue between users, monitor a changing situation, or provide information in some way personalized to the requirements of the individual user.(2) Dynamic contentThe second type is a website with dynamic content displayed in plain view. Variable content is displayed dynamically on the fly based on certain criteria, usually by retrieving content stored in a database.A website with dynamic content refers to how its messages, text, images and other information are displayed on the web page and more specifically how its content changes at any given moment. The web page content varies based on certain criteria, either pre-defined rules or variable user input. For example, a website with a database of news articles can use a pre-defined rule which tells it to display all news articles for today's date. This type of dynamic website will automatically show the most current news articles on any given date. Another example of dynamic content is when a retail website with a database of media products allows a user to input a search request for the keyword Beatles. In response, the content of the web page will spontaneously change the way it looked before, and will then display a list of Beatles products like CD's, DVD's and books.5. Software systemsThere is a wide range of software systems, such as Java Server Pages (JSP), the PHP and Perl programming languages, Active Server Pages (ASP), Yuma and ColdFusion (CFML) that are available to generate dynamic web systems and dynamic sites. Sites may also include content that is retrievedfrom one or more databases or by using XML-based technologies such as RSS.Static content may also be dynamically generated either periodically, or if certain conditions for regeneration occur (cached) in order to avoid the performance loss of initiating the dynamic engine on a per-user or per-connection basis.Plugins are available to expand the features and abilities of web browsers, which use them to show active content, such as Microsoft Silverlight, Adobe Flash, Adobe Shockwave or applets written in Java. Dynamic HTML also provides for user interactivity and real time element updating within web pages (ie pages don't have to be loaded or reloaded to effect any changes), mainly using the Document Object Model (DOM) and JavaScript, support which is built-in to most modern web browsers.Turning a website into an income source is a common practice for web developers and website owners. There are several methods for creating a website business which fall into two broad categories, as defined below.(1) Content-based siteSome websites derive revenue by selling advertising space on the site (see Contextual advertising).(2) Product- or service-based sitesSome websites derive revenue by offering products or services for sale. In the case of e-commerce websites, the products or services may be purchased at the website itself, by entering credit card or other payment information into a payment form on the site. While most business websites serve as a shop window for existing brick and mortar businesses, it is increasingly the case that some websites are businesses in their own right; that is, the products they offer are only available for purchase on the web.Websites occasionally derive income from a combination of these two practices. For example, a website such as an online auctions website may charge the users of its auction service to list an auction, but also display third-party advertisements on the site, from which it derives further income.网站文章来自维基百科,自由的百科全书网站是一组相关的网页,图片,视频或其他数字资产的集合,是针对相对的一个共同的统一资源定位符(URL),这个定位器往往由域名,或组成的IP地址在以网络为基础的互联网协议上的根路径构成。
JSP软件毕业外文翻译---Struts——MVC 的一种开放源码实现
Struts——an open-source MVC implementationBy: Malcolm Davis.Source: Struts--an open-source MVC implementation[J].IBM Systems JournalThis article introduces Struts, a Model-View-Controller implementation that uses servlets and JavaServer Pages (JSP) technology. Struts can help you control change in your Web project and promote specialization. Even if you never implement a system with Struts, you may get some ideas for your future servlets and JSP page implementation. IntroductionKids in grade school put HTML pages on the Internet. However, there is a monumental difference between a grade school page and a professionally developed Web site. The page designer (or HTML developer) must understand colors, the customer, product flow, page layout, browser compatibility, image creation, JavaScript, and more. Putting a great looking site together takes a lot of work, and most Java developers are more interested in creating a great looking object interface than a user interface. Java Server Pages (JSP) technology provides the glue between the page designer and the Java developer.If you have worked on a large-scale Web application, you understand the term change. Model-View-Controller (MVC) is a design pattern put together to help control change. MVC decouples interface from business logic and data. Struts is an MVC implementation that uses Servlets 2.2 and JSP 1.1 tags, from the J2EE specifications, as part of the implementation. You may never implement a system with Struts, but looking at Struts may give you some ideas on your future Servlets and JSP implementations.Model-View-Controller (MVC)JSP tags solved only part of our problem. We still have issues with validation, flow control, and updating the state of the application. This is where MVC comes to the rescue. MVC helps resolve some of the issues with the single module approach by dividing the problem into three categories:•ModelThe model contains the core of the application's functionality. The model encapsulates the state of the application. Sometimes the only functionality it contains is state. It knows nothing about the view or controller.•View•The view provides the presentation of the model. It is the look of the application. The view can access the model getters, but it has no knowledge of the setters. In addition, it knowsnothing about the controller. The view should be notified when changes to the model occur. ControllerThe controller reacts to the user input. It creates and sets the model.MVC Model 2The Web brought some unique challenges to software developers, most notably the stateless connection between the client and the server. This stateless behavior made it difficult for the model to notify the view of changes. On the Web, the browser has to re-query the server to discover modification to the state of the application.Another noticeable change is that the view uses different technology for implementation than the model or controller. Of course, we could use Java (or PERL, C/C++ or what ever) code to generate HTML. There are several disadvantages to that approach:•Java programmers should develop services, not HTML.•Changes to layout would require changes to code.•Customers of the service should be able to create pages to meet their specific needs.•The page designer isn't able to have direct involvement in page development.•HTML embedded into code is ugly.For the Web, the classical form of MVC needed to change. Figure 4 displays the Web adaptation of MVC, also commonly known as MVC Model 2 or MVC 2.Figure 4. MVC Model 2Struts, an MVC 2 implementationStruts is a set of cooperating classes, servlets, and JSP tags that make up a reusable MVC 2 design. This definition implies that Struts is a framework, rather than a library, but Struts also contains an extensive tag library and utility classes that work independently of the framework. Figure 5 displays an overview of Struts.Figure 5. Struts overviewStruts overview•Client browserAn HTTP request from the client browser creates an event. The Web container will respond with an HTTP response.•ControllerThe Controller receives the request from the browser, and makes the decision where to send the request. With Struts, the Controller is a command design pattern implemented as a servlet. The struts-config.xml file configures the Controller.•Business logicThe business logic updates the state of the model and helps control the flow of the application. With Struts this is done with an Action class as a thin wrapper to the actual business logic.•Model stateThe model represents the state of the application. The business objects update the application state. ActionForm bean represents the Model state at a session or request level, and not at a persistent level. The JSP file reads information from the ActionForm bean using JSP tags.•ViewThe view is simply a JSP file. There is no flow logic, no business logic, and no model information -- just tags. Tags are one of the things that make Struts unique compared to other frameworks like Velocity.Struts detailsDisplayed in Figure 6 is a stripped-down UML diagram of the org.apache.struts.action package. Figure 6 shows the minimal relationships among ActionServlet (Controller), ActionForm (Form State), and Action (Model Wrapper).Figure 6. UML diagram of the relationship of the Command (ActionServlet) to the Model (Action & ActionForm)The ActionServlet classDo you remember the days of function mappings? You would map some input event to a pointer to a function. If you where slick, you would place the configuration information into a file and load the file at run time. Function pointer arrays were the good old days of structured programming in C.Life is better now that we have Java technology, XML, J2EE, and all that. The Struts Controller is a servlet that maps events (an event generally being an HTTP post) to classes. And guess what -- the Controller uses a configuration file so you don_t have to hard-code the values. Life changes, but stays the same.ActionServlet is the Command part of the MVC implementation and is the core of the Framework. ActionServlet (Command) creates and uses Action, an ActionForm, and ActionForward. As mentioned earlier, the struts-config.xml file configures the Command. During the creation of the Web project, Action and ActionForm are extended to solve the specific problem space. The file struts-config.xml instructs ActionServlet on how to use the extended classes. There are several advantages to this approach:•The entire logical flow of the application is in a hierarchical text file. This makes it easier to view and understand, especially with large applications.•The page designer does not have to wade through Java code to understand the flow of the application.•The Java developer does not need to recompile code when making flow changes.Command functionality can be added by extending ActionServlet.The ActionForm classActionForm maintains the session state for the Web application. ActionForm is an abstract class that is sub-classed for each input form model. When I say input form model, I am saying ActionForm represents a general concept of data that is set or updated by a HTMLform. For instance, you may have a UserActionForm that is set by an HTML Form. The Struts framework will:•Check to see if a UserActionForm exists; if not, it will create an instance of the class.•Struts will set the state of the UserActionForm using corresponding fields from the HttpServletRequest. No more dreadful request.getParameter() calls. For instance, the Struts framework will take fname from request stream and call UserActionForm.setFname().•The Struts framework updates the state of the UserActionForm before passing it to the business wrapper UserAction.•Before passing it to the Action class, Struts will also conduct form state validation by calling the validation() method on UserActionForm. Note:This is not always wise to do. There might be ways of using UserActionForm in other pages or business objects, where the validation might be different. Validation of the state might be better in the UserAction class.•The UserActionForm can be maintained at a session level.Notes:•The struts-config.xml file controls which HTML form request maps to which ActionForm.•Multiple requests can be mapped UserActionForm.•UserActionForm can be mapped over multiple pages for things such as wizards.The Action classThe Action class is a wrapper around the business logic. The purpose of Action class is to translate the HttpServletRequest to the business logic. To use Action, subclass and overwrite the process() method.The ActionServlet (Command) passes the parameterized classes to ActionForm using the perform() method. Again, no more dreadful request.getParameter() calls. By the time the event gets here, the input form data (or HTML form data) has already been translated out of the request stream and into an ActionForm class.Note: "Think thin" when extending the Action class. The Action class should control the flow and not the logic of the application. By placing the business logic in a separate package or EJB, we allow flexibility and reuse.Another way of thinking about Action class is as the Adapter design pattern. The purpose of the Action is to "Convert the interface of a class into another interface the clients expect. Adapter lets classes work together that couldn_t otherwise because of incompatibility interface" (from Design Patterns - Elements of Reusable OO Software by Gof). The client in this instance is the ActionServlet that knows nothing about our specific business classinterface. Therefore, Struts provides a business interface it does understand, Action. By extending the Action, we make our business interface compatible with Struts business interface. (An interesting observation is that Action is a class and not an interface. Action started as an interface and changed into a class over time. Nothing's perfect.) The Error classesThe UML diagram (Figure 6) also included ActionError and ActionErrors. ActionError encapsulates an individual error message. ActionErrors is a container of ActionError classes that the View can access using tags. ActionErrors is Struts way of keeping up with a list of errors.Figure 7. UML diagram of the relationship of the Command (ActionServlet) to the Model (Action)The ActionMapping classAn incoming event is normally in the form of an HTTP request, which the servlet Container turns into an HttpServletRequest. The Controller looks at the incoming event and dispatches the request to an Action class. The struts-config.xml determines what Action class the Controller calls. The struts-config.xml configuration information is translated into a set of ActionMapping, which are put into container of ActionMappings. (If you have not noticed it, classes that end with s are containers)The ActionMapping contains the knowledge of how a specific event maps to specific Actions. The ActionServlet (Command) passes the ActionMapping to the Action class via the perform() method. This allows Action to access the information to control flow.ActionMappingsActionMappings is a collection of ActionMapping objects.Struts prosUse of JSP tag mechanismThe tag feature promotes reusable code and abstracts Java code from the JSP file. This feature allows nice integration into JSP-based development tools that allow authoring with tags.•Tag libraryWhy re-invent the wheel, or a tag library? If you cannot find something you need in the library, contribute. In addition, Struts provides a starting point if you are learning JSP tag technology.•Open sourceYou have all the advantages of open source, such as being able to see the code and having everyone else using the library reviewing the code. Many eyes make for great code review.•Sample MVC implementationStruts offers some insight if you want to create your own MVC implementation.•Manage the problem spaceDivide and conquer is a nice way of solving the problem and making the problem manageable. Of course, the sword cuts both ways. The problem is more complex and needs more management.Struts cons•YouthStruts development is still in preliminary form. They are working toward releasing a version 1.0, but as with any 1.0 version, it does not provide all the bells and whistles.•ChangeThe framework is undergoing a rapid amount of change. A great deal of change has occurred between Struts 0.5 and 1.0. You may want to download the most current Struts nightly distributions, to avoid deprecated methods. In the last 6 months, I have seen the Struts library grow from 90K to over 270K. I had to modify my examples several times because of changes in Struts, and I am not going to guarantee my examples will work with the version of Struts you download.•Correct level of abstractionDoes Struts provide the correct level of abstraction? What is the proper level of abstraction for the page designer? That is the $64K question. Should we allow a page designer access to Java code in page development? Some frameworks like Velocity say no, and provide yet another language to learn for Web development. There is some validity to limiting Java code access in UI development. Most importantly, give a page designer a little bit of Java, and he will use a lot of Java. I saw this happen all the time in Microsoft ASP development. In ASP development, you were supposed to create COM objects and then write a little ASP script toglue it all together. Instead, the ASP developers would go crazy with ASP script. I would hear"Why wait for a COM developer to create it when I can program it directly with VBScript?" Struts helps limit the amount of Java code required in a JSP file via tag libraries. One such library is the Logic Tag, which manages conditional generation of output, but this does not prevent the UI developer from going nuts with Java code. Whatever type of framework you decide to use, you should understand the environment in which you are deploying and maintaining the framework. Of course, this task is easier said than done.•Limited scopeStruts is a Web-based MVC solution that is meant be implemented with HTML, JSP files, and servlets.•J2EE application supportStruts requires a servlet container that supports JSP 1.1 and Servlet 2.2 specifications. This alone will not solve all your install issues, unless you are using Tomcat 3.2. I have had a great deal of problems installing the library with Netscape iPlanet 6.0, which is supposedly the first J2EE-compliant application server. I recommend visiting the Struts User Mailing List archive (see Resources) when you run into problems.•ComplexitySeparating the problem into parts introduces complexity. There is no question that some education will have to go on to understand Struts. With the constant changes occurring, this can be frustrating at times. Welcome to the Web.•Where is...I could point out other issues, for instance, where are the client side validations, adaptable workflow, and dynamic strategy pattern for the controller? However, at this point, it is too easy to be a critic, and some of the issues are insignificant, or are reasonable for a 1.0 release. The way the Struts team goes at it, Struts might have these features by the time you read this article, or soon after.Future of StrutsThings change rapidly in this new age of software development. In less than 5 years, I have seen things go from cgi/perl, to ISAPI/NSAPI, to ASP with VB, and now Java and J2EE. Sun is working hard to adapt changes to the JSP/servlet architecture, just as they have in the past with the Java language and API. You can obtain drafts of the new JSP 1.2 and Servlet 2.3 specifications from the Sun Web site. Additionally, a standard tag library for JSP files is appearing.Struts——MVC 的一种开放源码实现作者:Malcolm Davis来源:Struts--an open-source MVC implementation[J]. IBM Systems本文介绍Struts,它是使用servlet 和JavaServer Pages 技术的一种Model-View-Controller 实现。
jsp技术简介
JSP技术简介什么是JSP?JSP(JavaServer Pages)是一种用于创建动态网页的技术。
它允许开发人员将动态内容(如数据库查询结果或用户输入)嵌入到HTML页面中。
与静态网页不同,JSP页面可以根据不同的请求和数据来生成不同的输出。
JSP是基于Java编程语言的,因此开发人员可以使用Java的强大功能来实现复杂的业务逻辑。
同时,它也是在服务器端运行的,这意味着用户无需下载任何插件或软件,并且可以通过任何支持HTTP协议的浏览器访问到JSP页面。
JSP的优点1.易于学习和使用:与其他服务器端技术相比,JSP是学习曲线较为平缓的。
它是用HTML和Java代码混合编写的,因此对于熟悉HTML和Java的开发人员来说,上手相对容易。
2.代码重用:JSP页面可以通过组件、标签库和自定义标签等方式实现代码的重用。
这使得开发人员可以更加高效地开发和维护项目。
3.动态内容生成:JSP允许开发人员在HTML页面中嵌入Java代码,这使得动态内容的生成变得非常简单。
开发人员可以使用Java的强大功能处理和操作数据,从而提供与用户交互的动态页面。
4.可扩展性:JSP技术是基于Java的,可以与其他Java技术(如Servlet和EJB)无缝集成。
这使得开发人员能够构建复杂的企业级应用程序,并实现高度的可扩展性。
5.跨平台性:由于JSP是在服务器端运行的,所以它可以在任何支持Java的操作系统上运行。
这意味着开发人员可以使用一套代码在不同的操作系统上部署应用程序。
JSP的工作原理JSP的工作原理可以简单概括为以下几个步骤:1.编写JSP页面:开发人员编写JSP页面,它包含了HTML和Java代码。
Java代码通常使用特殊的标签(<% %>)来标识。
2.编译为Servlet:当第一次访问JSP页面时,容器会将JSP页面编译成一个Servlet。
这个过程是自动的,开发人员无需手动进行。
3.创建Servlet实例:每次有请求到达JSP页面时,容器都会为该请求创建一个Servlet实例。
网上商城系统毕业设计外文翻译
毕业设计说明书英文文献及中文翻译班级:学号:姓名:学院:专业:指导教师:1 Struts Framework Based on MVCIn the traditional Web application, Java Server Pages(JSP) pages are responsible for handling all things, for example, receiving requests, executing business logics, choosingthe next page. These complicated things may lead to chaos of JSP pages’ codes and be harmful for the extension and maintenance of pages. The Model-View-Controller (MVC) mode separates the programming codes into three different areas, which has solved the above problem. MVC can realize J2EE application system's stratification and the loose coupling of three layers or multilayer, and it is a realization way of orienting dynamic content. The MVC mode divides application into three core components of Model, View and Controller.Struts is a realization of MVC. It is an open source Web application framework and uses Servlet and JSP marks that belong to the J2EE norm as a part of the realization. Struts inherits MVC characteristics and realizes some corresponding changes and extension according to J2EE traits. Struts separates Java codes of JSP by Java Bean and Action class to be the MVC mode, transmits data among the three partitions of Model, View and Controller, demonstrates the connection between various classes and JSP pages by configuration files finally and it intends to realize the separation of presentation layer, business layer and data layer. The Struts structure is shown in Figure 1.The Model contains the business logic that exchanges data with a persistence layer. The View is in charge of producing what is directly visible to the user, . web pages. The Controller is the layer that receives requests from clients, determines what business logic takes place and where to go next. In the Struts framework, the Model uses Java classes for the business logic. The View can be implemented with JSP and the Tag lib of Struts. The Controller is a J2EE component known as Servlet, more specifically an ActionServlet object, which determines what or when logic gets executed and where the control should get directed.2 Hibernate Framework Based on ORMWorking with both the object-oriented software and the relational database is a complicated task with Java Database Connectivity (JDBC) because there is mismatch between how data is represented in objects versus relational database. So with JDBC, developers have to write pure the Structured Query Languag (SQL) statements to map an object model's data representation to a relational data model and its corresponding database schema.Introduction of HibernateHibernate is a flexible and powerful Object-Relational Mapping (ORM) solution to map Java classes to database tables. It is a powerful, high performance object-relational persistence and query service. Hibernate allows developers to express queries in its own portable SQL extension (Hibernate Query Language (HQL))[3], as well as in native SQL, or with an object-oriented criteria and example Application Programming Interface(API). Hibernate itself takes care of this mapping using XML files so developers don’t need to write code for this.Hibernate is an open source and it is free to use for both development and production deployments, which is a bridge between Java application and relational database and takes charge of mapping between Java objects and relational data. The inside of Hibernate packs the operation of accessing database by JDBC, which provides API of object-oriented database access to upper layer application. So developers can use the object programming thought to operate database sufficiently, caring for the bottom database structure unnecessarily.Hibernate relieves the developer from 95 percent of common data persistence related programming tasks, compared to manual coding with SQL and the JDBC API[4]. And it can integrate various Web server or application server, and nearly support all popular databases server.Principle of HibernateAs shown in figure , Hibernate lies in the middle layer that is between applicationand database .In the provided persistent service, Hibernate maps class to rows of datasheet by properties and mapping files of class itself. Application interacts with database by Persitstent Object (PO) to handle data directly.ApplicationPersistent ObjectsHibernateHibernate.properties XML.MappingDatabaseFigure Hibernate systematic structure3 The Integration of Struts and HibernateIn the open source frameworks, for the presentation part, Tapestry has the powerful and natural combination of pages, its document is too conceptional to benefit programming. And its learning curve was too steep and so on. For the logic part, Spring has a good integration function, but there is a lack of public controller. And EJB depends on the EJB containers, at the same time, it is realized complicatedly. While Struts has been applied extensively because of its advantages.At present, most of systems apply the relational databases mainly, while Java is an object-oriented language essentially. In Model part of Struts framework application, using SQL and JDBC to operate databases when storing and fetching objects reduces programming efficiency and the systematic maintainability. Traditional J2EE-based application applies heavyweight framework based on EJB that adapts to the large enterprise development, while development and debugging by EJB container need to consume a plenty of time and high price. EJB3 improves the disadvantages of original EJB, but its application is not mature yet.Hibernate can substitute Container-Managed Persistence (CMP) to accomplish heavy responsibility of permanence in J2EE framework of applying a word, Hibernate can resolve the difficulties coming from using traditional CMP, JDBC and Data Access Object(DAO) in a technological development. For reducing the coupling of code and raising systematic development efficiency, this paper suggests J2EE application development tactics based on Struts and Hibernate.The Struts design shows the MVC framework sufficiently, which all control flows need a configuration file to manage, and which is convenient to maintain. The integration of Struts and Hibernate is that Hibernate solves the model layer of Struts, which makes developers operate Java objects instead of database. The integration shows the object-oriented thought sufficiently and solves some problems of the database operation in traditional J2EE well.Flow of FrameworkThe flow of integration framework based on Struts and Hibernate is shown in Figure 3. At first, users send Http requests by Browser, then Http requests are accepted by ActionServlet of the control component in business layer, then gave to RequestProcessor which gets corresponding Action from ActionMapping by request URL[3]. Besides, ActionForm packs JSP pages, which can make a checking to data of datasheet if it is needed, send back ActionErrors to visual pages if there are mistakes and transfer the data of pages to Action if it passes validation.Request Processor transfers the “execute” method of Action and the method transfers the business logic module. Hibernate accomplishes interaction of databases and JavaBean. The operation of processing business logic interacts with database by data permanence layer and field object layer. The “execute” method of Action will return ActionForward objects that are accepted by ActionServlet after executing.Systematic Structure of the Integration FrameworkThe EIS layer of the multi-layer J2EE systematic structure can be partitioned into the data permanence layer and the data resource layer. It means a system can be divided into five layers as a whole.Client Layer: This layer runs in the Browser of users’ machin es and handles interaction with users, transmits and shows messages to users. J2EE platform supports different type users including HTML users, Java Applets, Java application, etc.Presentation Layer: This layer works in J2EE Web container, produces the systematic representation logic, handles users’ requests and makes the responses. The entire Web is built on Struts framework, in which the View component is composed of JSP/HTML pages whose data is expressed by ActionForm Bean, the Controller component is composed of ActionServlet united and Action Classes, and the Model component is realized by business logic Logic Layer: This layer accomplishes the required business of system, provides the required business method to presentation layer. It can receive data from client programs and save them to the storage equipment after proper disposal, read data from the data storage equipment, then send them out to client programs.1 基于MVC的Struts框架在传统的Web应用程序,Java服务器页面(JSP)页面负责处理所有的事情,例如,接收请求,执行业务逻辑,选择下一个页面。
JSP技术简介及特点外文翻译
附录AJSP Technology Conspectus And Specialties The JSP (Java Server mix) technology is used by the Sun microsystem 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 span of a few years, has formed a complete set of standards, and widely used in electronic 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 Web 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 applications 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 one, in the JSP technology existed before the emergence of several excellent dynamic web technology, such as CGI, ASP, etc. With the introduction of these technologies under dynamic web technology, the development and the JSP. TechnicalJSP the development background and development historyIn web brief history, from a world wide web that most of the network information static on stock transactions evolution to acquisition of an operation and infrastructure. In a variety of applications, may be used for based on Web client, look no restrictions.Based on the browser client applications than traditional based on client/server applications has several advantages. These benefits include almost no limit client access and extremely simplified application deployment and management (to update an application, management personnel only need to change the program on a server, not thousands of installation in client applications). So, the software industry is rapidly to build on the client browser multi-layer application.The rapid growth of exquisite based Web application requirements development of technical improvements. Static HTML to show relatively static content is right choice, The new challenge is to create the interaction based on Web applications, in these procedures, thecontent 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. Developers write to interface with the relevant procedures and separate based on Web applications, 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. If multiple concurrent users access to this procedure, these processes will use the Web server of all available resources, and the performance of the system will be reduced to extremely low.Some Web server providers have to provide for their server by plugins "and" the API to simplify the Web application development. These solutions are associated with certain Web server, cannot solve the span multiple suppliers solutions. For example, Microsoft's Active Server mix (ASP) technology in the Web page to create dynamic content more easily, but also can work in Microsoft on Personal Web Server and IIS.There are other solutions, but cannot make an ordinary page designers can easily master. For example, such as the Servlet Java technologies can use Java language interaction application server code easier. Developers to write such Servlet to receive signals from the Web browser to generate an HTTP request, a dynamic response (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 program (with different, the latter operating in the Applet browser end). In this book the Servlet chapter 4.Using this method, the entire page must have made in Java Servlet. If developers or Web managers want to adjust page, you'll have to edit and recompile the Servlet 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 scope of the pages of the solution. This program will solve the current scheme are limited. 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.The JSP technology is designed to meet such requirements. The JSP specification is a Web server, application server, trading system and develop extensive cooperation between the tool suppliers. From this standard to develop the existing integration and balance of Java programming environment (for example, Java Servlet and JavaBeans) support techniques and tools. The result is a kind of new and developing method based on Web applications, using component-based application logic page designers with powerful functions.Overall Semantics of a JSP PageA JSP page implementation class defines a _jspService() method mapping from the request to the response object. Some details of this transformation are specific to the scripting language used (see Chapter JSP.9, “Scripting”). Most details are not language specific and are described in this chapter.The content of a JSP page is devoted largely to describing the data that is written into the output stream of the response. (The JSP container usually sends this data back to the client.) The description is based on a JspWriter object that is exposed through the implicit object out (see Section JSP.1.8.3, “Implicit Objects”). Its value varies:Initially, out is a new JspWriter object. This object may be different from the stream object returned from response.getWriter(), and may be considered to be interposed 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 from writing directly to either the PrintWriter or OutputStream associated with the ServletResponse.The JSP container should not invoke response.getWriter() 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 different (nested) instance of a JspWriter object. Whether this is the case depends on the 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 buffered, and require explicit flushing to a nesting stream or their contents will be discarded.If the initial out JspWriter object is buffered, then depending upon the value of the autoFlush attribute of the page directive, the content of that buffer will either be automaticallyflushed out to the ServletResponse output stream to obviate overflow, or an exception shall be thrown to signal buffer overflow. If the initial out JspWriter is unbuffered, then content written to it will be passed directly through to the ServletResponse output stream.A JSP page can also describe what should happen when some specific events occur. 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 names” 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 LiveScript called. Then quickly Netscape LiveScript renamed JavaScript, Java developers with them from the same issued a statement. A statement Java and JavaScript will complement each other, but they are different, so the technology of the many dismissed 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 write out their JavaScript version and the JScript called. Microsoft and Netscape support JavaScript and JScript around a core characteristics and European Manufacturers is.md by (ECMA) standards organization, the control standard of scripting language. ECMA its scripting language ECMAScript named.Servlets and JSPs often include fragments of information that are common to an organization, such as logos, copyrights, trademarks, or navigation bars. The web application uses the include mechanisms to import the information wherever it is needed, since it is easier to change content in one place then to maintain it in every piece of code where it is used. Some of this information is static and either never or rarely 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 must be localized for each user. In both cases, you want to ensure that the servlet or JSP 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 the including JSP page, and give the included JSP segment a .jspf extension.You want to include content in a JSP each time it receives a request, rather than 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 descriptor.You want to include a fragment of an XML file inside of a JSP document, or include a JSP page in XML syntax. Use the jsp:include standard action for the includes that you want to occur with each request of the JSP. Use the jsp:directive.include element if the include action should occur during the translation phase.You want to include a JSP segment from outside the including file's context. Use the c:importThe 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 of uncertain 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.附录BJSP技术简介及特点JSP(Java Server Pages)技术是由Sun公司发布的用于开发动态Web应用的一项技术。
JSP及其WEB技术外文资料翻译
外文资料翻译资料来源:文章名:JSP And WEB Technology书刊名:《Communications Technology》作者:Damon Hougland, Aaron Tavistock出版社:InfoQ,2010.3章节:Chapter3页码:P34~P45文章译名:JSP及其WEB技术姓名:学号:指导教师(职称):专业:计算机科学与技术(工程方向)班级:所在学院:计算机科学与工程学院外文原文:JSP and WEB technology1 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 application procedure'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 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 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 otherplatform, 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 pa ge 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 pro vide. 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 perm its 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 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 mostfoundation'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 document s 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), Act ion 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 anorder 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 usuall y 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 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 concret e 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 HTML typesetting and the contact surface effect's limitation ex poses 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 ma ny 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 HTM L 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 Js script language synopsisJS is javascrip, Javascript is one kind the script l anguage 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 n etwork 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 f rom 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 thebatch 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 home page 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 ex ample 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 realiz e this process. All scripts are realize through this method.JSP及其WEB技术译文:1 JSP简介JSP(JavaServer Pages)是一种基于Java的脚本技术。
JSP技术发展史外文翻译
外文原文The technique development history of JSPWriter:Bluce Rakel From: /zh-cn/magazine/cc163420.aspx The 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.A. 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 mixs 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.C. 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 strongagain, 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 contentses.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 languageses, such as the EMAC- Script, WebL 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.C. 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 ASPses are all in several year agos 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 contentses 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 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 contentses 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技术发展史作者:Bluce Rakel 出处:/zh-cn/magazine/cc163420.aspx Java Server Pages(JSP)是一种基于web的脚本编程技术,类似于网景公司的服务器端Java脚本语言——server-side JavaScript(SSJS)和微软的Active Server Pages(ASP)。
jsp英汉互译
<%@page language="java"import="java.util.*"pageEncoding="UTF-8"%> <%String path = request.getContextPath();String basePath =request.getScheme()+"://"+request.getServerName()+":"+request.getServer Port()+path+"/";%><!DOCTYPE HTML PUBLIC"-//W3C//DTD HTML 4.01 Transitional//EN"><html><head><base href="<%=basePath%>"><title>My JSP 'fan.jsp' starting page</title><meta http-equiv="pragma"content="no-cache"><meta http-equiv="cache-control"content="no-cache"><meta http-equiv="expires"content="0"><meta http-equiv="keywords"content="keyword1,keyword2,keyword3"> <meta http-equiv="description"content="This is my page"><!--<link rel="stylesheet" type="text/css" href="styles.css">--></head><body align="left"><STYLE>BODY {COLOR: black; FONT-SIZE: 9pt}TD {COLOR: black; FONT-SIZE: 9pt}TH {COLOR: black; FONT-SIZE: 9pt}A {TEXT-DECORATION: none}A:hover {COLOR: blue}TD {CURSOR: hand}.cs {COLOR: navy; CURSOR: hand}</STYLE><TABLE bgcolor="#d9f2ef"border=1borderColorDark=whiteborderColorLight=black=0=0height=500width=700align="left"><TBODY><TR vAlign=top><TD style="CURSOR: auto"><FORM action=http://202.110.201.11/instanttrans/instanttransmethod=post><TABLE bgcolor="#d9f2ef"border=1borderColorDark=whiteborderColorLight=black cellPadding=0cellSpacing=0id=mtv width=390> <TBODY><TR align=middle><TDonclick="one();a.style.color='black';b.style.color='gray';c.style.color ='gray';d.style.color='gray';e.style.color='gray';f.style.color='gray';g.style.color='gray';"style="BORDER-BOTTOM: 0px" width="10%"><B><FONTid=a>常用1</FONT></B></TD><TDonclick="a1();this.style.borderBottom='0';a.style.color='gray';b.style. color='black';c.style.color='gray';d.style.color='gray';e.style.color=' gray';f.style.color='gray';g.style.color='gray';"width="10%"><B><FONT color=gray id=b>常用2</FONT></B></TD><TDonclick="a2();this.style.borderBottom='0';a.style.color='gray';b.style. color='gray';c.style.color='black';d.style.color='gray';e.style.color=' gray';f.style.color='gray';g.style.color='gray';"width="10%"><B><FONT color=gray id=c>动词</FONT></B></TD><TDonclick="a3();this.style.borderBottom='0';a.style.color='gray';b.style. color='gray';c.style.color='gray';d.style.color='black';e.style.color=' gray';f.style.color='gray';g.style.color='gray';"width="10%"><B><FONT color=gray id=d>连词</FONT></B></TD><TDonclick="a4();this.style.borderBottom='0';a.style.color='gray';b.style. color='gray';c.style.color='gray';d.style.color='gray';e.style.color='b lack';f.style.color='gray';g.style.color='gray';"width="10%"><B><FONT color=gray id=e>描述</FONT></B></TD><TDonclick="a5();this.style.borderBottom='0';a.style.color='gray';b.style. color='gray';c.style.color='gray';d.style.color='gray';e.style.color='g ray';f.style.color='black';g.style.color='gray';"width="10%"><B><FONT color=gray id=f>物主</FONT></B></TD><TDonclick="a6();this.style.borderBottom='0';a.style.color='gray';b.style. color='gray';c.style.color='gray';d.style.color='gray';e.style.color='g ray';f.style.color='gray';g.style.color='black';"width="10%"><B><FONT color=gray id=g>时差</FONT></B></TD><TD onclick=help() style="CURSOR: help"width="10%"><U>帮助</U></TD></TR></TBODY></TABLE><DIV id=nnn><TABLE bgcolor="#d9f2ef"border=1borderColorDark=white borderColorLight=black cellPadding=4cellSpacing=0id=tv rules=none style="BORDER-TOP: 0px" width=500><TBODY><TR align=middle><TD onclick="asp.value+='Computer'"width="10%">电脑</TD><TD onclick="asp.value+='Network'"width="10%">网络</TD><TD onclick="asp.value+='Information'"width="10%">信息</TD><TD onclick="asp.value+='Chat'"width="10%">聊天</TD><TD onclick="asp.value+='Study'"width="10%">学习</TD><TD onclick="asp.value+='Glacier'"width="10%">冰河</TD><TD onclick="asp.value+='Game'"width="10%">游戏</TD><TD onclick="asp.value+='Hobbyhorse'"width="10%">木马</TD><TD onclick="asp.value+='Webpage'"width="10%">网页</TD><TD onclick="asp.value+='Keyboard'"width="10%">键盘</TD></TR><TR align=middle><TD onclick="asp.value+='Mouse'"width="10%">鼠标</TD><TD onclick="asp.value+='Software'"width="10%">软件</TD><TD onclick="asp.value+='Hardware'"width="10%">硬件</TD><TD onclick="asp.value+='Equipment '"width="10%">设备</TD> <TD onclick="asp.value+='Operation'"width="10%">操作</TD><TD onclick="asp.value+='Procedure'"width="10%">程序</TD><TD onclick="asp.value+='System'"width="10%">系统</TD><TD onclick="asp.value+='Programming'"width="10%">编程</TD><TD onclick="asp.value+='Attribute'"width="10%">属性</TD><TD onclick="asp.value+='Input'"width="10%">输入</TD></TR><TR align=middle><TD onclick="asp.value+='Export'"width="10%">输出</TD><TD onclick="asp.value+='Editor'"width="10%">编辑</TD><TD onclick="asp.value+='Multimedia'"width="10%">多媒体</TD><TD onclick="asp.value+='Content'"width="10%">内容</TD><TD onclick="asp.value+='Hacker'"width="10%">黑客</TD><TD onclick="asp.value+='Video'"width="10%">视频</TD><TD onclick="asp.value+='File'"width="10%">文件</TD><TD onclick="asp.value+='Duplicate'"width="10%">复制</TD><TD onclick="asp.value+='Paste'"width="10%">粘贴</TD><TD onclick="asp.value+='Remove'"width="10%">清除</TD></TR><TR align=middle><TD onclick="asp.value+='Virus'"width="10%">病毒</TD><TD onclick="asp.value+='Start'"width="10%">启动</TD><TD onclick="asp.value+='Channel'"width="10%">频道</TD><TD onclick="asp.value+='Symbol'"width="10%">符号</TD><TD onclick="asp.value+='Special'"width="10%">特殊</TD><TD onclick="asp.value+='Code'"width="10%">代码</TD><TD onclick="asp.value+='Byte'"width="10%">字节</TD><TD onclick="asp.value+='Deliver'"width="10%">发送</TD><TD onclick="asp.value+='Cancel'"width="10%">撤消</TD><TD onclick="asp.value+='Run'"width="10%">运行</TD></TR><TR align=middle><TD onclick="asp.value+='Join'"width="10%">连接</TD><TD onclick="asp.value+='Address'"width="10%">地址</TD><TD onclick="asp.value+='Data'"width="10%">数据</TD><TD onclick="asp.value+='Characters'"width="10%">文字</TD><TD onclick="asp.value+='Translate'"width="10%">翻译</TD><TD onclick="asp.value+='Free'"width="10%">免费</TD><TD onclick="asp.value+='Serve'"width="10%">服务</TD><TD onclick="asp.value+='Tabletop'"width="10%">桌面</TD><TD onclick="asp.value+='save'"width="10%">存储</TD><TD onclick="asp.value+='write'"width="10%">写</TD></TR></TBODY></TABLE></DIV><TABLE bgColor=#dedede border=1borderColorDark=whiteborderColorLight=black=0=vvv=500cellsapcing="0"><TBODY><TR><TD colSpan=10><TEXTAREA cols=40id=asp name=content rows=6 style="WIDTH: 100%" wrap=VIRTUAL></TEXTAREA></TD></TR><TR align=middle><TD height=onclick="if(nnj.style.color='gray'){nnj.style.color='blue';jjn.style.co lor='gray'};mtv.width='600';vvv.width='700';tv.width='700';asp.rows='13 '"onmouseout="this.style.backgroundColor='dedede'"onmouseover="this.style.backgroundColor='eeeeee'"><FONTcolor=blueid=jjn>扩大</FONT></TD><TD height=20onclick="if(jjn.style.color='gray'){jjn.style.color='blue';nnj.style.co lor='gray'}mtv.width='390';vvv.width='500';tv.width='500';asp.rows='6'; "onmouseout="this.style.backgroundColor='dedede'"onmouseover="this.style.backgroundColor='eeeeee'"><FONTcolor=grayid=nnj>缩小</FONT></TD><TD height=20onclick=asp.value=asp.value.toUpperCase()onmouseout="this.style.backgroundColor='dedede'"onmouseover="this.style.backgroundColor='eeeeee'"><FONTcolor=blue>大写</FONT></TD><TD height=20onclick=asp.value=asp.value.toLowerCase();onmouseout="this.style.backgroundColor='dedede'"onmouseover="this.style.backgroundColor='eeeeee'"><FONTcolor=blue>小写</FONT></TD><TD height=20onclick=asp.value+=asp.valueonmouseout="this.style.backgroundColor='dedede'"onmouseover="this.style.backgroundColor='eeeeee'"><FONTcolor=blue>复写</FONT></TD><TD height=20onclick=asp.select()onmouseout="this.style.backgroundColor='dedede'"onmouseover="this.style.backgroundColor='eeeeee'"><FONTcolor=blue>全选</FONT></TD><TD height=20onclick="var ppp=confirm('确认要清楚所有编写的英文?从新在做一边?');if(ppp!='0'){asp.value=''}"onmouseout=onmouseover="this.style.backgroundColor='eeeeee'"><FONTcolor=blue>新建</FONT></TD><TD height=20onclick="window.open('view-source:///c:/my document/苍山娱乐网English.txt','_self')"onmouseout="this.style.backgroundColor='dedede'"onmouseover="this.style.backgroundColor='eeeeee'"><FONTcolor=blue>保存</FONT></TD><TD height=20onclick="window.open('/cgi-bin/lyb/gb.cgi?id=孤独刺客&psd=');alert('上传指的是把你做的文章暂时保存在我站的留言本里面\n\n方便你以后学习调用,但我本人不能给你网址,\n\n好下面打开留言本,请你暂时复制到上面OK?');"onmouseout="this.style.backgroundColor='dedede'"onmouseover="this.style.backgroundColor='eeeeee'"></TD></TR></TBODY></TABLE><SCRIPT>function one(){nnn.innerHTML="<table cellspacing=0 cellpadding=4 border=1 bordercolorlight=black bordercolordark=white bgcolor=dedede width=500 style='border-top:0px' id=tv rules=none><Tr align=center><Tdonclick=asp.value+='Computer' width=10%>电脑</td><Tdonclick=asp.value+='Network' width=10%>网络</td><Tdonclick=asp.value+='Information' width=10%>信息</td><Tdonclick=asp.value+='Chat' width=10%>聊天</td><Tdonclick=asp.value+='Study' width=10%>学习</td><Tdonclick=asp.value+='Glacier' width=10%>冰河</td><Tdonclick=asp.value+='Game' width=10%>游戏</td><Tdonclick=asp.value+='Hobbyhorse' width=10%>木马</td><Tdonclick=asp.value+='Webpage' width=10%>网页</td><Tdonclick=asp.value+='Keyboard' width=10%>键盘</td></tr><Tralign=center><Td onclick=asp.value+='Mouse' width=10%>鼠标</td><Td onclick=asp.value+='Software' width=10%>软件</td><Tdonclick=asp.value+='Hardware' width=10%>硬件</td><Tdonclick=asp.value+='Equipment' width=10%>设备</td><Tdonclick=asp.value+='Operation' width=10%>操作</td><Tdonclick=asp.value+='Procedure' width=10%>程序</td><Tdonclick=asp.value+='System' width=10%>系统</td><Tdonclick=asp.value+='Programming' width=10%>编程</td><Tdonclick=asp.value+='Attribute' width=10%>属性</td><Tdonclick=asp.value+='Input' width=10%>输入</td></tr><Tr align=center><Td onclick=asp.value+='Export' width=10%>输出</td><Tdonclick=asp.value+='Editor' width=10%>编辑</td><Tdonclick=asp.value+='Multimedia' width=10%>多媒体</td><Tdonclick=asp.value+='Content' width=10%>内容</td><Tdonclick=asp.value+='Hacker' width=10%>黑客</td><Tdonclick=asp.value+='Video' width=10%>视频</td><Tdonclick=asp.value+='File' width=10%>文件</td><Tdonclick=asp.value+='Duplicate' width=10%>复制</td><Tdonclick=asp.value+='Paste' width=10%>粘贴</td><Tdonclick=asp.value+='Remove' width=10%>清除</td></tr><Tr align=center><Td onclick=asp.value+='Virus' width=10%>病毒</td><Tdonclick=asp.value+='Start' width=10%>启动</td><Tdonclick=asp.value+='Channel' width=10%>频道</td><Tdonclick=asp.value+='Symbol' width=10%>符号</td><Tdonclick=asp.value+='Special' width=10%>特殊</td><Tdonclick=asp.value+='Code' width=10%>代码</td><Tdonclick=asp.value+='Byte' width=10%>字节</td><Tdonclick=asp.value+='Deliver' width=10%>发送</td><Tdonclick=asp.value+='Cancel' width=10%>撤消</td><Tdonclick=asp.value+='Run' width=10%>运行</td></tr><Tr align=center><Td onclick=asp.value+='Join' width=10%>连接</td><Tdonclick=asp.value+='Address' width=10%>地址</td><Tdonclick=asp.value+='Data' width=10%>数据</td><Tdonclick=asp.value+='Characters' width=10%>文字</td><Tdonclick=asp.value+='Translate' width=10%>翻译</td><Tdonclick=asp.value+='Free' width=10%>免费</td><Tdonclick=asp.value+='Serve' width=10%>服务</td><Tdonclick=asp.value+='Tabletop' width=10%>桌面</td><Tdonclick=asp.value+='save' width=10%>存储</td><Tdonclick=asp.value+='write' width=10%>写</td></tr></table>"}</SCRIPT><SCRIPT>function a1(){nnn.innerHTML='<table cellspacing=0 cellpadding=4 border=1bordercolorlight=black bordercolordark=white bgcolor=dedede width=500 style="border-top:0px" id=tv rules=none><Tr align=center><Tdonclick=asp.value+="Question" width=10%>问题</td><Tdonclick=asp.value+="Respect" width=10%>方面</td><Tdonclick=asp.value+="Weather" width=10%>天气</td><Tdonclick=asp.value+="Online" width=10%>在线</td><Tdonclick=asp.value+="Quantity" width=10%>数量</td><Tdonclick=asp.value+="Make" width=10%>制作</td><Tdonclick=asp.value+="Volume" width=10%>音量</td><Tdonclick=asp.value+="Picture" width=10%>画面</td><Tdonclick=asp.value+="Quality" width=10%>质量</td><Tdonclick=asp.value+="Machine" width=10%>机器</td></tr><Tr align=center><Td onclick=asp.value+="Normal" width=10%>正常</td><Tdonclick=asp.value+="Change" width=10%>调整</td><Tdonclick=asp.value+="Mistake" width=10%>错误</td><Tdonclick=asp.value+="Figure" width=10%>图形</td><Tdonclick=asp.value+="Picture" width=10%>图片</td><Tdonclick=asp.value+="Form" width=10%>格式</td><Tdonclick=asp.value+="Copyright" width=10%>版权</td><Tdonclick=asp.value+="Domain" width=10%>版面</td><Tdonclick=asp.value+="Material" width=10%>素材</td><Tdonclick=asp.value+="Resources" width=10%>资源</td></tr><Tralign=center><Td onclick=asp.value+="Memory" width=10%>内存</td><Td onclick=asp.value+="Install" width=10%>安装</td><Tdonclick=asp.value+="Agreement" width=10%>协议</td><Tdonclick=asp.value+="Community" width=10%>社区</td><Tdonclick=asp.value+="Range" width=10%>范围</td><Tdonclick=asp.value+="Capacity" width=10%>容量</td><Tdonclick=asp.value+="Number" width=10%>号码</td><Tdonclick=asp.value+="Language" width=10%>语言</td><Tdonclick=asp.value+="Insert" width=10%>插入</td><Tdonclick=asp.value+="Routine" width=10%>常规</td></tr><Tr align=center><Td onclick=asp.value+="Materials" width=10%>资料</td><Tdonclick=asp.value+="Technology" width=10%>技术</td><Tdonclick=asp.value+="Download" width=10%>下载</td><Tdonclick=asp.value+="Engine" width=10%>引擎</td><Tdonclick=asp.value+="Manage" width=10%>管理</td><Tdonclick=asp.value+="Revise" width=10%>修改</td><Tdonclick=asp.value+="Investigate" width=10%>调查</td><Tdonclick=asp.value+="Automatic" width=10%>自动</td><Tdonclick=asp.value+="Space" width=10%>空间</td><Tdonclick=asp.value+="Web site" width=10%>网站</td></tr><Tralign=center><Td width=10% onclick=asp.value+="Choice">选择</td><Tdwidth=10% onclick=asp.value+="Theme">主题<Td width=10%onclick=asp.value+="Source">原文<Td width=10%onclick=asp.value+="Translated result">译文<Td width=10%onclick=asp.value+="Catalogue">目录<Td width=10%onclick=asp.value+="Delete">删除<Td width=10%onclick=asp.value+="The position">位置<Td width=10%onclick=asp.value+="Arrange">排列<Td width=10% onclick=asp.value+="Leave">离开<Td width=10% onclick=asp.value+="Enter">进入</tr></table>'}</SCRIPT><SCRIPT>function a2(){nnn.innerHTML='<table cellspacing=0 cellpadding=4 border=1bordercolorlight=black bordercolordark=white bgcolor=dedede width=500 style="border-top:0px" id=tv rules=none><Tr align=center><Tdonclick=asp.value+="Go to play" width=10%>去玩</tD><Tdonclick=asp.value+="go home" width=10%>回家</td><Tdonclick=asp.value+="walk" width=10%>走</td><Tdonclick=asp.value+="Have a meal" width=10%>吃饭</td><Tdonclick=asp.value+="Sleep" width=10%>睡觉</td><Tdonclick=asp.value+="Play ball" width=10%>打球</td><Tdonclick=asp.value+="Stroke" width=10%>抚摩</td><Tdonclick=asp.value+="Swim" width=10%>游泳</td><Tdonclick=asp.value+="Read" width=10%>读</td><Td onclick=asp.value+="write" width=10%>写</td></tr><Tr align=center><Td onclick=asp.value+="look" width=10%>看</td><Td onclick=asp.value+="Hear" width=10%>听</td><Td onclick=asp.value+="Do" width=10%>做</td><Td onclick=asp.value+="Fly" width=10%>飞</td><Td onclick=asp.value+="Flying" width=10%>飞着</td><Tdonclick=asp.value+="Run" width=10%>跑</td><Tdonclick=asp.value+="Running" width=10%>跑着</td><Tdonclick=asp.value+="Press" width=10%>按</td><Tdonclick=asp.value+="Smell" width=10%>闻</td><Tdonclick=asp.value+="Smelling" width=10%>闻着</td></tr><tralign=center><Td onclick=asp.value+="Inhale" width=10%>吸</td><Tdonclick=asp.value+="Inhaling" width=10%>吸着</td><Tdonclick=asp.value+="Fumble" width=10%>摸</td><Tdonclick=asp.value+="Fumble" width=10%>摸着</td><Tdonclick=asp.value+="Speak" width=10%>说话</td><Tdonclick=asp.value+="Work" width=10%>工作着</td><Tdonclick=asp.value+="Fall" width=10%>摔</td><Tdonclick=asp.value+="Falling" width=10%>摔着</td><Tdonclick=asp.value+="Press" width=10%>压</td><Tdonclick=asp.value+="Pressing" width=10%>压着</td></tr><Tralign=center><Td onclick=asp.value+="Crowd" width=10%>挤</td><Tdonclick=asp.value+="Crowding" width=10%>挤着</td><Tdonclick=asp.value+="Draw" width=10%>拉</td><Tdonclick=asp.value+="Drawing" width=10%>拉着</td><Tdonclick=asp.value+="Touch" width=10%>碰</td><Tdonclick=asp.value+="Collide" width=10%>撞</td><Tdonclick=asp.value+="Tear" width=10%>扯</td><Td onclick=asp.value+="Drive" width=10%>开车</td><Td onclick=asp.value+="Ride" width=10%>骑</td><Td onclick=asp.value+="Leave" width=10%>下</td></tr><Tr align=center><Td onclick=asp.value+="It is raining" width=10%>下着雨</td><Td onclick=asp.value+="Counting" width=10%>数着</td><Tdonclick=asp.value+="Catch" width=10%>抓</td><Td onclick=asp.value+="Drop" width=10%>落下</td><Td onclick=asp.value+="Float" width=10%>飘</td><Td onclick=asp.value+="Blow" width=10%>吹</td><Tdonclick=asp.value+="Sit down" width=10%>坐下</td><Tdonclick=asp.value+="Think" width=10%>想</td><Tdonclick=asp.value+="Dream" width=10%>梦</td><Tdonclick=asp.value+="Dream about" width=10%>梦见</td></tr><Tralign=center><Td onclick=asp.value+="Throw up" width=10%>吐</td><Td onclick=asp.value+="Stand up" width=10%>起来</td><Tdonclick=asp.value+="Go back" width=10%>回去</td><Tdonclick=asp.value+="Come over" width=10%>过来</td><Tdonclick=asp.value+="Chase" width=10%>追</td><Td onclick=asp.value+="Rob" width=10%>抢</td><Td onclick=asp.value+="Pull out" width=10%>拔</td></tr></table>'}</SCRIPT><SCRIPT>function a3(){nnn.innerHTML='<table cellspacing=0 cellpadding=4 border=1bordercolorlight=black bordercolordark=white bgcolor=dedede width=500 style="border-top:0px" id=tv rules=none><Tr align=center><Tdonclick=asp.value+="is" width=10%>是</td><Tdonclick=asp.value+="is not" width=10%>不是</td><Tdonclick=asp.value+="Perhaps" width=10%>或许</td><Tdonclick=asp.value+="He perhaps" width=10%>他或许</td><Tdonclick=asp.value+="Possible" width=10%>可能</td><Tdonclick=asp.value+="But" width=10%>但是</td><Tdonclick=asp.value+="Because" width=10%>因为</td><Tdonclick=asp.value+="Definite" width=10%>肯定</td><Tdonclick=asp.value+="Sure" width=10%>一定</td><Tdonclick=asp.value+="Do not know" width=10%>不会</td></tr><tr align=center><Td onclick=asp.value+="Know" width=10%>会</td><Tdonclick=asp.value+="But" width=10%>然而</td><Td onclick=asp.value+="And" width=10%>而且</td><Td onclick=asp.value+="With" width=10%>和</td><Td onclick=asp.value+="With" width=10%>与</td><Td onclick=asp.value+="Or" width=10%>或</td><Td onclick=asp.value+="cat" width=10%>能</td><Tdonclick=asp.value+="On" width=10%>于</td><Td onclick=asp.value+="Then" width=10%>于是</td><Td onclick=asp.value+="On" width=10%>就</td></tr><Tr align=center><Td onclick=asp.value+="Is" width=10%>为</td><Tdonclick=asp.value+="Certainly" width=10%>当然</td><Tdonclick=asp.value+="Already" width=10%>已经</td><Tdonclick=asp.value+="Same" width=10%>同</td><Td onclick=asp.value+="Too" width=10%>也</td><Td onclick=asp.value+="Think" width=10%>想</td><Td onclick=asp.value+="Willing" width=10%>愿意</td><Tdonclick=asp.value+="Thought" width=10%>以为</td><Tdonclick=asp.value+="For" width=10%>为了</td><Tdonclick=asp.value+="Perhaps" width=10%>也许</td></tr></table>'}</SCRIPT><SCRIPT>function a4(){nnn.innerHTML='<table cellspacing=0 cellpadding=4 border=1bordercolorlight=black bordercolordark=white bgcolor=dedede width=500 style="border-top:0px" id=tv rules=none><Tr align=center><Tdonclick=asp.value+="Extraordinary" width=10%>非常</td><Tdonclick=asp.value+="well" width=10%>好</td><Tdonclick=asp.value+="It is not good" width=10%>不好</td><Td onclick=asp.value+="Excellent" width=10%>棒</td><Tdonclick=asp.value+="Very much" width=10%>太</td><Tdonclick=asp.value+="A lot of" width=10%>多</td><Tdonclick=asp.value+="Few" width=10%>少</td><Tdonclick=asp.value+="Outstanding" width=10%>出色</td><Tdonclick=asp.value+="Lovely" width=10%>可爱</td><Tdonclick=asp.value+="Right" width=10%>不错</td></tr><Tr align=center><Td onclick=asp.value+="Very" width=10%>很</td><Tdonclick=asp.value+="Succeed" width=10%>成功</td><Tdonclick=asp.value+="Beautiful" width=10%>美丽</td><Tdonclick=asp.value+="Pure" width=10%>纯洁</td><Td onclick=asp.value+="Bad" width=10%>坏</td><Td onclick=asp.value+="Pitiful" width=10%>可怜</td><Td onclick=asp.value+="Strong" width=10%>强壮</td><Tdonclick=asp.value+="Weak" width=10%>弱</td><Tdonclick=asp.value+="Unmatched" width=10%>无敌</td><Td。
外文翻译---JSP简介
JSP introducedJSP (Java Server Pages) is Corporation initiates one kind of dynamic homepage technical standard by Sun Microsystems which, many companies participation establishes together. This technology has provided for the foundation demonstration dynamic production content Web page simple and direct and the fast method. The JSP technology design goal is makes the structure to be easier based on the Webapp lication procedure and quickly, but these application procedures can with each kind of Web server, using the server, the browser and the development kit work together. The JSP standard is the Web server, applies the server, the transaction system, as well as between the development kit supplier the broad cooperation result. In the traditional homepage HTML document (*htm, * html) center joins the Java procedure fragment (Scriptlet) and the JSP mark (tag), constituted the JSP homepage (* jsp). The Web server when meets visits the JSP homepage the request, first carries out procedure fragment, then will carry out the result to return by the HTML form for the customer. The procedure fragment may operate the database, again the directional homepage as well as transmits email and so on, this is a function which the establishment dynamic website needs. All procedures operation all in the server end execution, in the network transmits the result which only is obtains for the customer end, is lowest to the client browser request, may realize does not have Plugin, does not have ActiveX, non- Java Applet, even does not have Frame.JSP简介J SP(Java Server Pages)是由Sun Microsystems公司倡导、许多公司参与一起建立的一种动态网页技术标准。
计算机 JSP web 外文翻译 外文文献 英文文献
外文资料所译外文资料:①作者:Dan Malks②书名:Professional JSP③出版时间: 2000.7.26④所译章节: Chapter 1212.1IntroductoryGood Web application design tries to separate business objects, presentation, and manipulation of the objects into distinct layers. One benefit of using JavaServer Pages technology is that it allows us to separate the role of a Web designer more clearly from that of a software developer. While on a small-scale project, one individual may occupy both roles, on a larger project, they are likely to be separate and it is beneficial to separate their workflows as much as possible. Designing the architecture for your Web application is crucial to this separation.12.2 JSP architectureWe will examine a variety of ways to architect a system with JavaServer Pages, servlets, and JavaBeans. We will see a series of different architectures, each a development of the one before. The diagram below shows this process in outline; the individual parts of the diagram will be explained in turn later in this article.JSP architecture:When Sun introduced Java Server Pages, some were quick to claim that servlets had been replaced as the preferred request handling mechanism in Web-enabled enterprise architectures. Although JSP is a key component of the Java 2 Platform Enterprise Edition (J2EE) specification, serving as the preferred request handler and response mechanism, we must investigate further to understand its relationship with servlets.Other sections of Professional JSP explain the implementation details of JSP source translation and compilation into a servlets. Understanding that JSP is built on top of the servlet API, and uses servlet semantics, raises some interesting questions. Should we no longer develop stand-alone servlets in our Web-enabled systems? Is there some way to combine servlets and JSPs? If so, where do we place our Java code? Are there any other components involved in the request processing, such as JavaBeans? If so, where do they fit into the architecture and what type of role do they fulfill?It is important to understand that, although JSP technology will be a powerful successor to basic servlets, they have an evolutionary relationship and can be used in a cooperative and complementary manner.Given this premise, we will investigate how these two technologies, each a Java Standard Extension, can be used co-operatively along with other components, such as JavaBeans, to create Java-based Web-enabled systems. We will examine architecturalissues as they relate to JSP and servlets and discuss some effective designs while looking at the tradeoffs of each. Before jumping directly into a discussion of specific architectures, though, we will briefly examine the need to develop a variety of architectures.12.3 Code factoring and role separationOne of the main reasons why the JavaServer Pages technology has evolved into what it is today (and it's still evolving) is the overwhelming technical need to simplify application design by separating dynamic content from static template display data. The foundation for JSP was laid down with the initial development of the Java Web Server from Sun, which used page compilation and focused on embedding HTML inside Java code. As applications came to be based more on business objects and n-tier architectures, the focus changed to separating HTML from Java code, while still maintaining the integrity and flexibility the technology provided.In Chapter 5, JSP Sessions, in Professional JSP, we saw how beans and objects can be bound to different contexts just by defining a certain scope. Good application design builds on this idea and tries to separate the objects, the presentation, and the manipulation of the objects into distinct, distinguishable layers.Another benefit of using JSP is that it allows us to more cleanly separate the roles of a Web production/HTML designer individual from a software developer. Remember that a common development scenario with servlets was to embed the HTML presentation markup within the Java code of the servlet itself, which can be troublesome. In our discussion, we will consider the servlet solely as a container for Java code, while our entire HTML presentation template is encapsulated within a JSP source page. The question then arises as to how much Java code should remain embedded within our JSP source pages, and if it is taken out of the JSP source page, where should it reside?Let's investigate this further. On any Web-based project, multiple roles and responsibilities will exist. For example, an individual who designs HTML pages fulfills a Web production role while someone who writes software in the Java programming language fulfills a software development role.On small-scale projects these roles might be filled by the same individual, or two individuals working closely together. On a larger project, they will likely be filled by multiple individuals, who might not have overlapping skill sets, and are less productive if made too dependent on the workflow of the other.If code that could be factored out to a mediating servlet is included instead within HTML markup, then the potential exists for individuals in the software development role and those in the Web production role to become more dependent than necessary on the progress and workflow of the other. Such dependencies may create a more error-prone environment, where inadvertent changes to code by other team members become more common.This gives us some insight into one reason why we continue to develop basic servlets: they are an appropriate container for our common Java code that has been factored out of our JSP pages, giving our software development team an area of focus that is as loosely coupled to our JSP pages as possible. Certainly, there will be a need for these same individuals to work with the JSP source pages, but the dependency is reduced, and these pages become the focus of the Web-production team instead. Of course, if the same individual fulfills both roles, as is typical on a smaller project, such dependencies are not a major concern.So, we should try to minimize the Java code that we include within our JSP page, in order to uphold this cleaner separation of developer roles. As we have discussed, some of this Java code is appropriately factored to a mediating servlet. Code that is common to multiple requests, such as authentication, is a good candidate for a mediating servlet. Such code is included in one place, the servlet, instead of potentially being cut and pasted into multiple JSPs.We will also want to remove much of our business logic and data access code from our JSP page and encapsulate it within JavaBeans, called worker or helper beans. We start to see a pattern of code movement from our JSP into two areas: a servlet (or JSP) that sits in front of the main JSP, and JavaBeans that sit in back. We refer to this common pattern as "Factor Forward -- Factor Back," as shown in the figure below:Factor Forward -- Factor Back:Another way to think about what code should be localized and encapsulated is that our JSP page should reveal as little as possible of our Java code implementation details.Rather, the page should communicate our intent by revealing the delegating messages we send to worker beans, instructing them to get state from a model, or to complete some business processing.12.4 Redirecting and forwardingRedirecting and forwarding requests in JSPs and servlets takes place often, and it is important to understand the subtle difference between these two mechanisms even though they achieve the same goal (that is, a client asks for a resource on the server and a different resource is served to it):●When a servlet or JSP resource chooses to redirect the client (using aresponse.sendRedirect(url)) the request object does not reach the second resource directly since the underlying implementation is an HTTP redirect.The server sends an HTTP 302 message back to the client telling it that the resource has moved to another URL, and that the client should access it there.The bottom line is that the lifecycle of the initial request object that was accessed in the first JSP terminates with the end of the service method in the first JSP, or with the reply from the server.●In a forward mechanism the request object is forwarded to the second resource,thus maintaining any object bindings to the request and its state, without a round trip to the client on the network. This allows the first JSP to do some work internally and then send information to the second JSP asking it to do itsbit. (Servlets used a chaining mechanism to do this). See Chapter 5, JSP Sessions, in Professional JSP to get a clearer picture of scope. JSPs and servlets can use the forwarding mechanism to delegate tasks among themselves, in the process of separating dynamic and static content.Now, let's investigate how we build these systems.12.5 ArchitecturesBefore discussing specific architectures that we can use to build systems with servlets and JSP, it is worth mentioning two basic ways of using the JSP technology. Each of the architectures discussed in this chapter will be based on one of these approaches:●The first method is referred to here as the page-centric (or client-server)approach. This approach involves request invocations being made directly to JSP page.●In the second method, the dispatcher (or n-tier) approach, a basic servlet orJSP acts as a mediator or controller, delegating requests to JSP pages and JavaBeans.We will examine these approaches in light of a simple example, which will evolve to satisfy the requirements of various scenarios. The initial scenario involves providing a Web interface for guessing statistics about a soon-to-be-born baby. The guesses are stored, and can be reviewed later by the parents, to see who has guessed the closest. As the requirement scenarios become more sophisticated, such as adding the desire for a persistence mechanism, the solution scenarios will become more sophisticated, as well. Thus, our example will evolve and we will gain an understanding of how the various architectures that we discuss will help us build a system that satisfies these requirements in an elegant and effective manner.12.6 The page-centric approachApplications built using a client-server approach have been around for some time; they consist of one or more application programs running on client machines and connecting to a server-based application to work. (A good example would be a PowerBuilder or Oracle Forms-based system.) CGIs and pre-servlet applications were generally based on this simple 2-tier model, and with the introduction of servlets, 2-tier applications could also be created in Java.This model allows JSPs or servlets direct access to some resource like a database or legacy application to service a client's request: the early JSP specifications termed this a "Model 1" programming approach. The JSP page is where the incoming request is intercepted and processed, and the response is sent back to the client;JSPs only differed from servlets in this scenario by providing cleaner code and separating code from the content by placing data access in beans.Model 1 programming approach:The advantage of such an approach is that it is siple to program,and allows the page author to Generate dynamic content easily,based upon the request and the state resources.However this architecture does not scale up well for a large number of simultaneous clients since there would be a significant amount of request processing to be performed,and each request must establish or share a potentially scarce/expensive connection to the resource in question.(A good example would be JDBC connectons in servlets or JSPs and the need for connection pools.) Indiscriminate usage of this architecture usually leads to a significant amount of Java code embedded within the JSP page,this may not seem to be much of a problem for Java developers but it is certainly an issue if the JSP pages are maintained by designers:the code tends to get in the designe’s way,and you run the risk of your code becoming corrupted when others are tweaking the look and feel.译文12.1前言好的Web应用设计试图将业务对象,简报以及操作对象分为不同的层面。
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
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 / doP ost / 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开发服务器端应用的主要技术,是开发商务应用表示端的标准。