1、Web应用中英文对照外文翻译文献Web应用中英文对照外文翻译文献(文档含英文原文和中文翻译)外文:A Comparative Study of Web Application Design ModelsUsing the Java TechnologiesAbstract. The Servlet technology has been the most widely used technology for building scalable Web applications. In the events, there are four design models for developing
2、 Web applications using the Java technologies: Model 1, Model2, Struts, and JavaServer Faces (JSF). Model 1 employs a series of JSP pages; Model 2 adopts the Model-View-Controller pattern; Struts is a framework employing the Model 2 design model; and JSF is a new technology that supports ready-to-us
3、e components for rapid Web application development. Model 1 is not recommended for medium-sized and large applications as it introduces maintenance nightmare. This paper compares and evaluates the ease of application development and the performance of the three design models (Model 2, Struts, and JS
4、F) by building three versions of an online store application using each of the three design models, respectively.1 IntroductionToday, Web applications are the most common applications for presenting dynamic contents. There are a number of technologies for building Web applications, the most popular
5、of which is the Servlet technology . This technology gains its popularity from its superiority over other technologies such as CGI and PHP .Servlets are cumbersome to develop, however, because sending HTML tags requires the programmer to compose them into a String object and send this object to the
6、browser. Also, a minor change to the output requires the servlet to be recompiled. To address this issue, Sun Microsystems invented JavaServer Pages (JSP) . JSP allows HTML tags to be intertwined with Java code and each page is translated into a servlet. A JSP page is a servlet. However, compilation
7、 occurs automatically when the page is first requested. As a result, changing the output does not need recompilation. In addition, JSP enables the separation of presentation from the business logic through the use of JavaBeans and custom tag libraries. The norm now in developing Javabased Web applic
8、ations is to use servlets along with JavaServer Pages.In the later development, there are a number of design models for building servlet/JSP applications: Model 1, Model 2, Struts , and JSF . Model 1 and Model 2 were first mentioned in the early specifications of JSP. Model 1 strictly uses JSP pages
9、, with no servlets, and Model 2 uses the combination of both servlets and JSP pages. The terms of Model 1 and Model 2 have been used ever since. Model 1 is suitable for prototypes and very small applications, and Model 2 is the recommended design model for medium sized and large applications.As Mode
10、l 2 gained more acceptances in the industry, an open source initiative to build the Struts Framework was initiated. Struts perfects Model 2 by providing the controller part of the Model-View-Controller of Model 2. In addition, Struts provides better page navigation management and several custom tag
11、libraries for more rapid development. Despite its steep learning curve and the fact that it was never defined in any specification, Struts has been gaining popularity as the alternative to Model 2.JavaServer Faces is built under the Java Community Process under JSR-127.Sun Microsystems proposed this
12、 technology in the hope that JSF will be the ultimate model for building Java Web applications. The most important feature of JSF is the availability of ready-to-use components such as extensible UI components, easy page navigation, input validators, data converters and JavaBeans management.The prob
13、lem facing servlet/JSP programmers are to choose the most appropriate design model. Clearly, JSF provides a better solution in regard to development time. However, some people are not sanguine to adopt this technology for fear of performance penalty due to the overhead of the JSF implementation.We b
14、uild three versions of an online store application named BuyDirect using Model 2, Struts and JSF. The parameters compared are the number of lines of code, the number of classes, and the performance measurement results. We investigate which of the design models allows the most rapid development proce
15、ss. We evaluate the performances of the applications built upon these models. We provide some suggestions to perfect the existing design models to make development more rapid. The rest of the paper is organised as follows. Section 2 discusses the issues in Web development. Section 3 explains how the
16、 three design models address these development issues. Section 4 provides the details of the hardware and software used in these experiments. Section 5 presents the experiment results and analysis. Section 6 reviews the related work. Section 7 concludes by offering some suggestions to improve the ex
17、isting design models.2 Java Web Development Issues All Java Web development uses the Servlet technology as the underlying technology. As such, all Java Web applications have certain issues that need to be addressed:User Interface. The user interface is what the client browser renders as HTML tags. A
18、ny server-side component used in the application must be encoded into the corresponding HTML elements. Besides for displaying the content and data, the user interface is also responsible in receiving input from the user.Input Validation. User input needs to be validated. There are two types of input
19、 validation, server-side and client-side. As the name implies, the server-side input validation is performed on the server after the input reaches the server. Client-side input validation is done on the browser, usually by using JavaScript or other scripting languages. The advantages of using client
20、-side input validation are prompt response and reducing the server workload. The server-side input validation should always be performed regardless the presence of client-side validation because there is no guarantee the user browsers scripting feature is being on and malicious users can easily work
21、 around client-side validation.Model Objects. Model objects in Java-based Web applications are in the forms of JavaBeans. Model objects make up the Model part of the MVC based design model. A model object can be used to bind a component value to be used at a later stage. In addition, it can encapsul
22、ate business logic required for processing.Page Navigation. Almost all Web applications have multiple pages that the user can navigate from one to another. All MVC-based design models use a servlet as the Controller part. This servlet also acts as the sole entry point to the application. Which page
23、to be displayed after the current request is determined by the value of a specified request parameter. Managing page navigation is critically important.3 Web Application Design ModelsThe Model 2 design model is based on the Model-View-Controller (MVC) design pattern. As explained by Burbeck , there
24、are three main modules in MVC, the Controller, the View, and the Model. The Controller acts as the central entry point to the application. All user interactions go through this controller. The View contains the presentation part of the application, and the Model stores data or encapsulates business
25、logic of the application. In the later development, the Struts Framework provides a common framework to easily build Model 2 applications. Then, the last initiative is the JavaServer Faces, which also employs the MVC design pattern.In the following sections, we discuss these three design models and
26、explain how each design model addresses the development issues specified in the previous section.3.1 Model 2A Java Web application that is based on the Model 2 design model has one servlet(called the Controller servlet) that serves as the Controller part. All requests are first handled by this servl
27、et, which immediately dispatches the requests to the appropriate views using RequestDispatcher objects. Views in the Model 2 design model are represented by JSP pages. To store data, a Model 2 application uses JavaBeans, which are the Model part of the application. In addition to storing data, the J
28、avaBeans also encapsulate business logic. Each HTTP request carries an action parameter that indicates which view to dispatch this request to. The programmer must code the HTML tags for user interface in all JSP pages in the application and write input validation code. In addition, the model objects
29、 are managed by individual JSP pages.3.2 StrutsThe Struts Framework is an improvement of the Model 2 design model. It provides a default Controller servlet so that the user does not have to write and compile one. Struts alleviates the task of page navigation by allowing navigation rules to be presen
30、t in its application configuration file (an XML document). Changes to the navigation rules do not require recompilation of a Java servlet class. In addition to easier page navigation, Struts provides custom tag libraries that define tags representing HTML elements. One of these tags is used for erro
31、r handling and Struts is therefore capable of displaying localized error messages in support for internationalization. Struts applications use JavaBeans as their models, just like the Model 2 design model. In addition, Struts programmers have to write their own input validation code.3.3 JSFJSF also
32、employs a controller servlet that is called FacesServlet. This servlet is the only entry point to a JSF application. JSF also uses JSP pages as its views and JavaBeans as its model objects. Unlike Model 2 and Struts, however, JSF provides ready-to-use user interface components that can be written on
33、 JSP pages. Upon an invocation of a page of a JSF application, the FacesServlet constructs a component tree that represents the JSP page being requested. Some of the components can also trigger events, making JSF event-driven. For page navigation, JSF uses an approach similar to Struts, i.e., by allowing navigation rules to be de
copyright@ 2008-2022 冰豆网网站版权所有
经营许可证编号:鄂ICP备2022015515号-1