| 注册
home doc ppt pdf
请输入搜索内容

热门搜索

年终总结个人简历事迹材料租赁合同演讲稿项目管理职场社交

基于Java技术的Web应用设计模型的比较研究

z***u

贡献于2019-06-02

字数:32865


中文翻译
基Java技术Web应设计模型较研究
源:School of Computer Science and Engineering University of New South Wales
Sydney NSW 2052 Australia
作者:Budi Kurniawan and Jingling Xue


Servlet技术建立扩展性Web应中应广泛技术运JAVA技术开发Web应中四种模型分Model 1Model 2StrutsJavaServer Faces JSFModel 1连串JSP页面Model 2采模型视图控制器MVC模式Struts采Model 2设计模型框架JSF种支持readytouse组件进行快速Web应开发新技术Model 1中等型应说难维护推荐文通利Model 2StrutsJSF三种模型分构建三版线商店应程序较评价三种模型应程序开发性差异
1绪
Web应种展现动态容普遍方式构建Web应许种方法中流行Servlet技术种技术流行CGIPHP等技术更具优越性然Servlet开发说麻烦传送HTML标签时需程序员组合成字符串象象传浏览器样输出改动求Servlet重新编译基原SUN公司发明JavaServer Pages JSP技术JSP允许HTML标签Java代码混合起页面转化ServletJSPServlet编译JSP页面第次请求时动进行改变输出需重新编译外通JavaBean定制标签库JSP够表示业务逻辑相分离现基JAVAWeb应开发标准servletsJSP结合起出现许种设计模型构建servletJSP应Model 1Model 2Struts]JavaServer Faces JSFModel 1Model 2早JSP规范中提Model 1JSPservletModel 2结合JSPservletModel 1Model 2条件Model 1适合开发原型非常应Model 2开发中型型应推荐设计模型Model 2越越行业接受建立Struts框架开源项目启动Struts通Model 2提供模型视图控制器中控制器完善Model 2
外Struts提供更页面导航理机制定制标签库够进行更快速开发学难度实际没规范中定义作Model 2种代获流行JavaServer FacesJCPJSR127规范建立Sun公司力推项技术希够成构建Java Web应终模型JSF重特性readytouse组件支持扩展户接口组件简易页面导航输入验证数转换JavaBean理机制servletJSP程序员面问题选择合适设计模型明显JSF开发时间提供更解决方案然担心实施JSF开销带性降愿采种技术
Model 2 StrutsJSF分构建三版线商店应较参数代码行数类数目性测试结果
研究种设计模型够进行快速开发评估基模型应性提供建议完善现设计模型开发速度更快
文章余部分组织
第二部分讨Web开发中问题第三部分解释三设计模型解决开发问题第四部分详细介绍试验需硬件软件第五部分出试验结果进行分析第六部分回顾相关工作第七部分出结提出改进现设计模型建议
2 Web开发中问题
Java开发Servlet技术作基础技术样Java Web应问题需解决
1户接口客户浏览器呈现出HTML标签应中服务器端组件必须编码成正确HTML标签显示容数外户接口负责接收户输入
2户输入必须验证输入验证两种类型服务器端客户端顾名思义服务器端输入验证输入数达服务器服务器进行客户端输入验证浏览器完成般JavaScript脚语言利客户端进行输入验证处反应迅速够减轻服务器负载否存客户端输入验证服务器端输入验证定执行法保证户浏览器脚特性开恶意户够轻松绕客户端验证
3基JavaWeb应中模型象JavaBean形式出项模型象组成基MVC设计模型模型部分模型象够绑定组件值备阶段外够封装需执行业务逻辑
4数Web应包含页面够户页面跳转页面基MVC设计模式Servlet作控制部分Servlet作进入应唯入口前请求页面会显示取决请求参数具体值理页面导航关重
3 Web应设计模型
Model 2设计模型基模型视图控制器MVC设计模式正Burbeck解释MVC中三模块控制器视图模型控制器作应中心户交互通视图包含应显示模型存储数封装应业务逻辑Struts框架提供通框架够容易构建Model 2应动样MVC设计模式JSF章节讨三种设计模型说明种设计模型样解决前提开发问题

31 Model 2

基Model 2设计模型Java Web应作控制部分servlet称控制器servlet请求首先servlet处理通RequestDispatcher象请求迅速分派合适视图Model 2中视图通JSP页面表现JavaBean作Model 2 模型部分应中存储数存储数JavaBean封装业务逻辑HTTP请求带行参数指出视图指派请求程序员必须JSP页面中户接口编写HTML标签代码编写输入验证代码外模型象单独JSP页面理

32 Struts Struts

框架Model 2设计模型改进提供默认控制器servlet程序员非编写Struts允许应配置文件XML文件中编写导航规减轻页面导航务改变导航规需重新编译更简单页面导航Struts提供定制标签库定义标签代表HTML元素标签中处理异常Struts支持国际化够显示化错误消息Model 2样StrutsJavaBean作模型外Struts程序员必须编写输入验证代码

33 JSF

JSF样控制器servlet称FacesServletServlet整JSF应唯入口JSF样JSP页面作视图JavaBean作模型象Model 2StrutsJSF提供够写入JSP页面readytouse户接口组件JSF应中页面调FacesServlet建立组件树显示JSP页面请求部分组件够触发事件构成JSF事件驱动页面导航JSFStruts类似方法允许应控制文件XML文件中定义导航规
JSF应非JSFservletJSP应JSF事件驱动JSF户接口JSP页面服务诸表单输入框等Web组件组件JSF定制标签形式出现够保存数组件够嵌套组件中形成组件树状结构普通servletJSP应中JavaBean存储户输入数
4运行环境
实验软硬件详细描述

41 Servlet容器

Java Web应servlet容器中运行应中引擎处理接踵请求资源HTTP请求试验项目中Tomcat——Apache软件基金会开源servlet容器版号60基servlet容器通执行面务处理servlet 
创建HttpRequest象 
创建HttpResponse象 
传递HttpRequestHttpResponse象调Servlet接口service方法

42 测试客户端

进行性测试样Apache软件基金会JMeter19模拟户JMeter允许户选择定数量线程执行测试线程模拟户JMeter允许选择完成次测试测试次数JMeter测试Web应直接某IP址文路径端口号发出请求请求参数包含HTTP请求中测试JMeter服务器响应时间毫秒形式输出响应时间够服务器执行服务秒命中次数











43 硬件
性度量精度计算机进行应测试运行应台XP计算机配置Intel Core 1GHz CPU 1G RAM测试客户端运行JMeterWindows2000计算机具体配置Intel Core 1GHz CPU 1G RAM
5结
两类实验结果开发难易程度性开发难易程度较类数目代码行数数目显示遵某设计模型开发应难易程度应包含较少类较少代码行数说明应相言更容易构建应包含较类说明应需花费更时间开发
性度量结果通较两操作获查找操作应中普通操作浏览操作
51 应开发难易程度
表1显示应Model 2设计模型需花费努力Struts够问题减轻点JSF省力

Model 2
Struts
JSF
Servlet
#Classes
1
0
0
#Lines
74
0
0
Bean
#Classes
9
9
9
#Lines
348
348
348
JSP
#Classes
9
9
9
#Lines
809
733
534
Others
#Classes
12
10
3
#Lines
590
430
271
Total
#Classes
31
28
21
#Lines
1821
1511
1153
表1 应中类数目代码行数
Model 2 设计模型特点存控制器servletJavaBean类作模型JSP页面作视图控制器类通系列if语句负责页面导航规Model 2程序员必须输入验证编写代码实验中通部编写许定制标签库完成Model 2设计模型中类定制标签库标签负责输入验证数显示实际输入验证590行代码约代码30
Struts应中控制器servlet框架提供Struts程序员编写节省时间然然需应控制文件中编写导航规编写servlet容易应控制文件文编辑器编辑必编译然Struts框架提供错误处理机制然需手工编写输入验证进行输入验证类数量代码行数Model 2应相似Struts中类Action类调度请求默认控制servlet
JSF中提供验证组件编写输入验证JSF应开发员跳务外页面导航Struts相应控制文件JSF中类ContextListenerActionListener数库工具类
52 性度量
操作通110发户测量服务器响应时间(毫秒形式)户JMeter中设定定数量线程次测试进行10次取均值操作面章节中讨
521 查询操作
查询操作名称描述关键字匹配执行SQLSELECT语句图2较三版应查询操作










图2 查询操作性较
Model 2应中户服务器均响应时间173毫秒10户919毫秒Struts应中相值189毫秒900毫秒JSF中210毫秒932毫秒响应时间着发户数成例增加说明服务器然够应付装载
Model 2应开销均性StrutsJSF更然Struts性Model2 相服务器足够存加载运行Struts需Struts库时应该注意Struts中页面导航规加载存储ActionMapping象中出请求参数导航页面通查找方面出请求参数Model 2应利系列if语句页面导航
发户数字中JSF应性稍逊应JSF时间消耗请求构建颗组件树JSF服务器响应时间应差距明显
522 浏览操作
三版浏览操作查询操作执行SQL SELECT语句图3操作测试结果











图3 浏览性较
均说Model 2应性具少开销户服务器均响应时间111毫秒10户899毫秒Struts应着样性户服务器均响应时间180毫秒10户920毫秒JSF稍落两应相时间190毫秒1009毫秒响应时间着发户数成例增加意味着服务器服务户浏览均性测量结果查询操作相似两种数库操作类似
6相关工作
servletPHP(版 3)通网关接口(CGI)较基数库Web应性执行MySQL数库返回数系列基准测试发现Java servlet持久数库连接方案性佳PHP3持久数库连接相CGI方案言性相样提Java servlet优势根作者Java servlet迎合电子商务(线商店)需求佳选择够高交互式模式中处理客户请求
较PHP4Java servletEJB两应测试三种结构研究显示PHP4Java servlet更效EJB性servlet差然注意作Java方案部分servlet提供适应性够移植操作系统系统
7结
发现JSF构建Web应迅速Model 2慢性Struts应计较中处两种设计模型中间
提出建议体改善Servlet技术增强基设计模式应性
1 Struts没基规范没文档讨部工作方式难知道实现改善
2 Servlet技术Servlet23规范没定义缓存机制没Servlet24中提Web应容具动态性写容常改变线商店应中户浏览商品种类隔月变动次果半静态容必须次需时候数库中获取浪费量编程资源Servlet程序员通编写象缓存某容实现缓存然没缓存标准许程序员反复写相代码段
3 Model 2缺点页面导航规控制器servlet中硬编码意味着程序流程微改动需控制器servlet重新编译解决问题方法应启动时提供映射器读取页面导航规控制器servletinit方法中容易添加代码方法执行次servlet首次载入存时候果属性文件次改动需重新读取程序员次请求时检查属性文件时间戳先前读入文件较果前读入文件时间戳更新重新构建映射器特性文象初始化参数中开启者关闭开发角度讲特性应该开启部署时特性应该关闭属性文件存储页面导航规避免控制器中连串if语句次请求时消耗时间HashMap请求参数作Key值跳转页面作Value值设计模型缺陷缺少标准输入验证组件户接口组件JSF中解决
4 JSF解决开发Web应中部分问题页面导航理户接口组件输入验证组件然项技术然年轻没太户接口强迫程序员JSF非JSFservletsJSP页面相结合JSF事件驱动JSF程序员通编写事件监听决定JSF应行Swing应中监听器样JSF 10版中通常两类事件够触发ActionEventValueChangedEvent已应户间提供足够交互性










参考文献
1 Burbeck S Applications Programming in Smalltalk80 How to use ModelView
Controller (MVC) httpstwwwcsuiuceduuserssmarchstdocsmvchtml 1987
2 Cecchet E Chanda A Elnikety S Marguerite J Zwaenepoel W Performance
Comparison of Middleware Architectures for Generating Dynamic Web Content
Proceeding of the 4th International Middelware Conference 2003
3 Cecchet E Marguerite J and Zwaenepoel W Performance and Scalability of EJB
Applications Proceedings of OOPSLA’02 2002
4 Java Servlet 23 and JavaServer Pages 12 Specification (JSR053)
httpjcporgaboutJavacommunityprocessfinaljsr053
5 Java Servlet 24 Specification (Proposed Final Draft 3)
httpjcporgaboutJavacommunityprocessfirstjsr154index3html
6 JavaServer Faces Technology httpjavasuncomj2eejavaserverfaces
7 JBoss EJB server httpjbossorg
8 JMeter httpjakartaapacheorgjmeter
9 JOnAS Java Open Application Server httpwwwobjectweborgjonas
10 Sun Microsystems Comparing Methods for ServerSide Dynamic Content
httpjavasuncomproductsjspjspservlethtml 2000
11 The Apache Software Foundation httpwwwapacheorg
12 The Struts Framework httpjakartaapcheorgstruts
13 Wu A Wang H and Wilkins D Performance Comparison of Alternative Solutions forWebToDatabase Applications Proceedings of the Southern Conference on Computingthe University of Southern Mississippi 2000







•英文原文
A Comparative Study of Web Application Design Models Using the Java Technologies

Budi Kurniawan and Jingling Xue

School of Computer Science and Engineering
University of New South Wales Sydney NSW 2052 Australia

Abstract
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 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 ModelViewController pattern Struts is a framework employing the Model 2 design model and JSF is a new technology that supports readytouse components for rapid Web application development Model 1 is not recommended for mediumsized 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 JSF) by building three versions of an online store application using each of the three design models respectively
1 Introduction
Today Web applications are the most common applications for presenting dynamic
contents There are a number of technologies for building Web applications the most popular 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 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 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 applications is to use servlets along with JavaServer Pages
In the later development there are a number of design models for building servletJSP 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 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 Model 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 ModelViewController of Model 2 In addition Struts provides better page navigation management and several custom tag 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 [6] is built under the Java Community Process under JSR127 Sun Microsystems proposed this 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 readytouse components such as extensible UI components easy page navigation input validators data converters and JavaBeans management
The problem facing servletJSP programmers are to choose the most appropriate design model Clearly JSF provides a better solution in regard to development timeHowever some people are not sanguine to adopt this technology for fear of performance penalty due to the overhead of the JSF implementation
We build three versions of an online store application named BuyDirect using Model 2 Struts and JSF The parameters compared are the number of lines of codethe number of classes and the performance measurement results We investigate which of the design models allows the most rapid development process 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 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 existing 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 Any serverside 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 validation serverside and clientside As the name implies the serverside input validation is performed on the server after the input reaches the server Clientside input validation is done on the browser usually by using JavaScript or other scripting languages The advantages of using clientside input validation are prompt response and reducing the server workload The serverside input validation should always be performed regardless the presence of clientside validation because there is no guarantee the user browser's scripting feature is being on and malicious users can easily work around clientside validation
− Model Objects Model objects in Javabased 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 encapsulate business logic required for processing
− Page Navigation Almost all Web applications have multiple pages that the user can navigate from one to another All MVCbased design models use a servlet as the Controller part This servlet also acts as the sole entry point to the application Which page 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 Models
The Model 2 design model is based on the ModelViewController (MVC) design pattern As explained by Burbeck [1] there 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 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 explain how each design model addresses the development issues specified in the previous section
31 Model 2
A 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 servlet 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 JavaBeans 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 are managed by individual JSP pages
32 Struts
The 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 present 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 error 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
33 JSF
JSF also 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 readytouse user interface components that can be written on 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 eventdriven For page navigation JSF uses an approach similar to Struts ie by allowing navigation rules to be defined in an application configuration file (again an XML document)
What distinguishes a JSF application from nonJSF servletJSP application is that JSF applications are eventdriven The user interface of a JSF application is one or many JSP pages that host Web components such as forms and input boxes These components are represented by JSF custom tags and can hold data A component can be nested inside another and it is possible to draw a tree of components Just as in normal servletJSP applications you use JavaBeans to store the data the user entered
4 Experimental Setup
The software and hardware details for our experiments are described below
41 The Online Store Application
The online store application in this research comes in three versions Model 2 Struts and JSF All of them are named BuyDirect an online store that sells electronics goods The application has the following features
Search for certain products based on product names or descriptions
Browse the list of products by category
View a product's details
Put a product into the shopping cart
View the shopping cart
Check out and place an order
This application represents the most common Web application that provides the following functionality
searching for certain information in the database
browsing the data in the database
performing database transactions
Data is stored in a MySQL database The tables used and the relationship among them are depicted in Figure 1

42 The Servlet Container
A Java Web application runs in a servlet container which is the engine that processes the incoming HTTP requests for the resources in the application For this research project we use Tomcat an open source servlet container from the Apache Software
Foundation The version we use is 502 [11]
Basically a servlet container processes a servlet by performing the following tasks
Creating the HttpRequest Object
Creating the HttpResponse Object
Calling the service method of the Servlet interface passing the HttpRequest and
HttpResponse objects
43 Testing Clients
For performance testing we emulate multiple users using JMeter 19 [9] also from the Apache Software Foundation JMeter allows the user to choose the number of threads to perform testing Each thread emulates a different user JMeter also lets us choose how many times a test will be done To test a Web application using JMeter you direct requests to certain IP address context path and port number You can also specify request parameters to be included in each HTTP request As the output JMeter notifies the response time of the server in milliseconds for a test From the response time we derive the number of hitsseconds the server is capable of serving
44 Hardware
We use different computers for running the applications and for testing so as to obtain maximum performance measurement accuracy The computer running the application is a Linux machine having the following hardware specifications Intel Pentium III 750MHz CPU with 256MB RAM The computer running the testing clients is a Windows 2000 machine running JMeter The computer has the following specifications Intel Pentium III 850MHz CPU with 256MB RAM
5 Experimental Results
We obtain experimental results in two categories the ease of development and performance The ease of development category compares the number of classes and the number of lines of code These numbers indicate how easy it is to develop an application by following a certain design model An application with the fewer number of classes or the number of lines of code indicates that the application is relatively easier to build The application with the more number of classes indicates that the application takes more time to develop
The performance measurement results are obtained by comparing three operations in each version of the online store application Search Browse and Shopping The Search operation is the most common operation in such an application The Browse operation displays products by category and the Shopping operation is the most complex operation of all It includes filling in the Order form and inserting products in the shopping cart to the database The database is locked during the product insertion so either all shopping items are stored in the database or none of them is
51 Ease of Application Development
As Table 1 shows it takes the most effort to implement the Model 2 design model
Using Struts alleviates the problem a bit and the best saving in the development comes if one uses JSF
Table 1 The number of classes and the number of lines for the applications under study

The Model 2 design model is characterised by the presence of a Controller servlet and a number of JavaBeans classes (as the Model) and JSP pages (as the Views) The Controller servlet is responsible for page navigation rules that employ a series of if statements Model 2 application programmers must also code for the input validation that in this research is implemented inside a number of custom tag libraries The other classes in the Model 2 design model are custom tag library and the tag library descriptors responsible for input validation and data display In fact input validation takes 590 lines of code or almost 30 of the total amount of code
In the Struts application the Controller servlet is provided by the framework therefore a Struts programmer saves time for not having to write one However heshe still needs to write page navigation rules in the Application Configuration file which is easier than writing a servlet because the Application Configuration file can be edited using a text editor and no compilation is necessary Input validation must still be done manually even though the Struts Framework provides an error handling mechanism The number of classes and the number of lines of code for input validation are almost similar to the Model 2 application In Struts the other classes are Action classes to which the default Controller servlet dispatches requests
In JSF input validation comes free through the availability of validator component As a result a JSF application developer can skip this task In addition page navigation takes the same course as Struts ie by utilising an Application Configuration file The other classes in JSF are a ContextListener an ActionListener and a Database utility class
52 Performance Measurement
For each operation we measure the server response time (in milliseconds) for 1 to 10 concurrent users The number of users is specified by setting the number of threads in Jmeter Each test is conducted 10 times and the average is taken Each operation is discussed further is the following subsections
521 Search Operation
The Search operation retrieves all products whose name or description matches the keyword There is one SQL SELECT statement performed Figure 2 compares the three versions of applications for the Search operation

For the Model 2 application the average server response time for one user is 173 ms and for 10 users is 919 ms For the Struts application these numbers are 189 ms and 900 ms respectively For the application built using JSF the average server response time is 210 ms for one user and 932ms for 10 users The increase of the response time I proportional to the increase of the number of concurrent users which means that the server is still able to cope with the load
The Model 2 application has the least overhead therefore the average performance should be better than the Struts and JSF applications However the Struts application performs as well as the Model 2 application This is because the server has enough memory to load all Struts libraries required to run Struts Also note that page navigation rules in Struts are loaded and stored in an object called ActionMapping Therefore given an action request parameter the next page of navigation is obtained through a lookup On the other hand the Model 2 application uses a series of if statements to find the next page of navigation given the action request parameter
The JSF application performs slightly worse than the other applications in almost all numbers of concurrent users This could be due to the time taken by the JSF implementation to construct a component tree for each page requested However the difference in server response time between JSF and other applications is not that significant
522 Browse Operation
The Browse operation retrieves all products belonging to the specified category for the three versions of applications Like the Search operation there is one SQL SELECT statement performed Figure 3 gives the test results for this operation

On average the Model 2 application performs the best because it has the least overhead The average server response time is 111 ms for one user and 899 ms for 10 users The Struts application has comparable performance with one user average server response time of 180 ms and 10 user response time of 920 ms The JSF lacks a bit behind the two applications with these numbers being 190 and 1009 ms respectively
The increase of the server response time is proportional to the increase of the number of concurrent users which means the server is able to serve those users well
The average performance measurement results of the Browse operation are very similar to the ones for the Search operation because the database operations of both operations are also similar
523 Shopping Operation
This operation includes a database transaction with an insert into the Orders table and multiple inserts into the OrderDetails table The transaction either succeeds or fails as a whole Figure 4 shows the test results for this operation
The Model 2 application results in an average server response time of 230 ms for one user and 2088 ms for 10 users The Struts application scores similar results with 238 ms and 2033 ms for both one user and 10 concurrent users The JSF application takes an average of 240 ms to server one user and 2227 ms for 10 concurrent users

Figure 4 shows that in all applications a linear increase in the number of concurrent
users causes an almost exponential increase in the average server response time This is due to the lock in the database during the database transaction that causes subsequent requests to be queued until the database lock is released
Performance comparison for the Model 2 Struts and JSF applications for the Shopping operation is almost the same as the Search and Browse operations Model 2 and Struts perform similarly while the JSF application is worse However the difference between the JSF application and the other two is not significant
6 Related Work
Wu et al [13] compare the performance of databasebased Web applications using Java servlets PHP version 3 and Common Gateway Interface (CGI) After a series of benchmark tests that performs data retrieval from a MySQL database they find that the solution of Java servlets with persistent database connection has the best performance PHP3 using persistent database connections performs fairly well when compared to the CGI solution They also mention the advantages of using Java servlets According to these authors Java servlets are an excellent choice to meet the requirement of ecommerce (such as online shopping) applications and are able to handle client requests in a highly interactive mode However Wu et al do not provide analysis of the architectures of the system they are testing Nor do they study the ease of development and ease of maintenance aspects of those technologies
Cecchet et al [2] conduct similar research this time comparing PHP 4 Java servlets and Enterprise JavaBeans They measure the performance of these three architectures using two applications an online bookstore and an auction site The online bookstore stresses the server backend whereas the auction site represents an application with most workload on the server front end Their study reveals that PHP4 is more efficient than Java servlets and the EJBs perform even worse than servlets However they note that servlets being part of the Java solution provides the flexibility of being able to be ported to another system with a different operating system This research too does not compare design models of the same technology as we do Neither does it offer an insight into the underlying code of the technologies
In a similar study Cecchet et al [3] evaluate the performance and scalability of EJB applications using two different open source J2EE containers JBoss 24 [7] and JOnAS 244 [9] as well as the performance of the EJB applications with servletbased solutions They find that the servletsonly application they build performs the best due to the fewer number of layer communications in the server They find that JOnAS 244 outperforms JBoss 24 because of the more efficient design of the J2EE application server This study is different from ours because it compares the efficiency of the infrastructure software (the J2EE containers) as opposed to the design models of the applications
Also worth mention is the white paper from Sun Microsystems [10] that presents the functionality comparison of Java servlets PHP and CGI
7 Conclusion
We find that it is most rapid to build Web applications using JSF Model 2 applications are the least rapid but give the best performance Struts applications sit in the middle of the other two design models in both comparisons
We make some suggestions that could improve the Servlets technology in general and enhance the performance of applications based on both design models
− Struts Struts is not based on any specification and there is no documentation that discusses its internal working Therefore it is hard to know what have been implemented and what could be improved
− The Servlets Technology The Servlet 23 Specification does not define any caching mechanism There is no mention of caching in the upcoming Servlet 24 Specification either Despite the dynamic nature of the content of a Web application some contents do not change very often For example the categories of products that a user can browse in an online store application probably only change once in a month If those semistatic contents must be generated from the database every time they are requested a lot of programming resources will be wasted Servlet programmers get around the absence of caching by writing an object that caches certain content However since there is no standard for caching many programmers write the same piece of code again and again
− Model 2The main drawback is that the page navigation rules are hardcoded in the Controller servlet This means any minor change to the program flow will require the Controller servlet to be recompiled The solution to this problem is to provide a mapper that reads the page navigation rules when the application starts The code could be conveniently written in the init method of the Controller servlet This method is only executed once ie the first time the servlet is loaded into memory If the properties file needs to be reread every time it changes the programmer can check the timestamp of the properties file for each request and compares it with the previous read of this file If the timestamp is more current than the previous read the mapper can be reconstructed This feature can be enabled and disabled by using an initial parameter in the Context object At the development phase this feature should be enabled At deployment this feature should be off The use of the properties file to store the page navigation rules also makes it possible to avoid a series of if statements in the Controller Servlet which can be timeconsuming forevery request Instead a HashMap can be used with action request parameters as keys and the next JSP pages as values The other disadvantage of this design model is the absence of standard components for input validation and user interface However this has been solved in JSF
− JSF JSF provides solutions to common problems in Web development such as page navigation management UI components and input validators However because this technology is still very young there are not too many UI components available forcing programmers to combine JSF with nonJSF servletsJSP pages JSF is eventdriven JSF programmers determine the behavior of a JSF application by writing event listeners just like those listeners in a Swing application In JSF version 10 there are currently two types of events that can be triggered ActionEvent and ValueChangedEvent However this is good enough to provide sufficient level of interactivity between the application and its users Adding more types of events will definitely make JSF more appealing









8 References
1 Burbeck S Applications Programming in Smalltalk80 How to use ModelView
Controller (MVC) httpstwwwcsuiuceduuserssmarchstdocsmvchtml 1987
2 Cecchet E Chanda A Elnikety S Marguerite J Zwaenepoel W Performance
Comparison of Middleware Architectures for Generating Dynamic Web Content
Proceeding of the 4th International Middelware Conference 2003
3 Cecchet E Marguerite J and Zwaenepoel W Performance and Scalability of EJB
Applications Proceedings of OOPSLA’02 2002
4 Java Servlet 23 and JavaServer Pages 12 Specification (JSR053)
httpjcporgaboutJavacommunityprocessfinaljsr053
5 Java Servlet 24 Specification (Proposed Final Draft 3)
httpjcporgaboutJavacommunityprocessfirstjsr154index3html
6 JavaServer Faces Technology httpjavasuncomj2eejavaserverfaces
7 JBoss EJB server httpjbossorg
8 JMeter httpjakartaapacheorgjmeter
9 JOnAS Java Open Application Server httpwwwobjectweborgjonas
10 Sun Microsystems Comparing Methods for ServerSide Dynamic Content
httpjavasuncomproductsjspjspservlethtml 2000
11 The Apache Software Foundation httpwwwapacheorg
12 The Struts Framework httpjakartaapcheorgstruts
13 Wu A Wang H and Wilkins D Performance Comparison of Alternative Solutions forWebToDatabase Applications Proceedings of the Southern Conference on Computingthe University of Southern Mississippi 2000
文档香网(httpswwwxiangdangnet)户传

《香当网》用户分享的内容,不代表《香当网》观点或立场,请自行判断内容的真实性和可靠性!
该内容是文档的文本内容,更好的格式请下载文档

下载文档,方便阅读与编辑

文档的实际排版效果,会与网站的显示效果略有不同!!

需要 10 香币 [ 分享文档获得香币 ]

该文档为用户出售和定价!

购买文档

相关文档

基于JAVA WEB的考勤系统设计与实现

基于 JAVA WEB 的考勤系统设计和实现Design and Implementation of Attendance System Based on JAVA WEB摘要科技的发展,带动一系列产业的升级和创新;网络技术的不断更新迭代,冲击着人们的日常生活状态。人们越来越想更方便记录自身企业的考勤情况。但企业部门的多样化,给人们在传统考勤统计中带来了很大

平***苏 10个月前 上传358   0

基于Java Web的旅游信息网站

基于Java Web的旅游信息网站Tourism information website based on Java Web内容摘要本次开发的网站是基于JSP/Servlet的 WEB旅游应用网站,该网站是以互联网传播为媒介来实现旅游信息发布、共享的平台网站。本次论文主要论述的是的网站整个开发和设计的过程。在开发过程中,我们主要运用了java程序设计语言、数据库

平***苏 10个月前 上传288   0

基于Web技术的驾校考试系统的设计与实现毕业设计

基于Web技术的驾校考试系统的设计与实现毕业设计 摘 要 在网络技术逐渐渗入社会生活各个层面的今天,传统的考试方式也面临着变革,而网上考试则是网络技术一个很重要的发展方向。网上考试一方面可以突破时空的界限;另一方面考生在自己熟悉的环境中考试也会更自在,能更好地发挥自己的真实水平,网络考试方式将是以后考试发展的趋势。 本论文主要阐述了基于Web技术的驾校考试系统的设计与实现。论文首先对

z***u 5年前 上传1579   0

基于java Web的房屋租售网站

基于java Web的房屋租售网站House rental and sale website based on Java web内容摘要本毕业设计题目为《基于Java Web的网上房屋租售网站》,是在信息化时代下充分利用互联网对传统房屋租售方式进行创新,在互联网上进行房屋租售突破了传统方式的局限性。对于房屋租售的当事人都提供了极大的便利。本稳

平***苏 10个月前 上传215   0

基于WEB SERVICE技术新华书店连锁系统

分类号 …………………….. 密级……………………U D C …………………… 编号…………………… 中 南 大 学CENTRAL SOUTH UNIVERSITY硕士学位论文论 文 题 目 基于WEB SERVICE技术新华书店连锁系统(BSCMS)的开发和研究学 科、专业

郭***林 2年前 上传339   0

基于web学生成绩管理系统设计与实现

随着计算机技术在各行各业的广泛应用,将计算机技术应用到学校中去,将大大提高学校管理的效率。学生成绩管理系统将在提高学校管理效率中发挥重要作用。

平***苏 3年前 上传936   0

基于Web的作业系统设计与开发

基于Web的作业系统开发与设计基于Web的作业系统开发与设计摘 要本作业系统是基于原有的教学管理模式,通过构建B/S架构,使用Java Server page(简称“JSP”)为本设计的前台开发使用的工具,使用MySQL数据库为后台数据库,从而去实现教学管理的信息化。通过对现有教学管理模式的梳理,本次设计主要分为三个大的模块:作业系统管理员模块、老师角色模块、学生角色模块

平***苏 1年前 上传273   0

基于web的易销售网站的设计与实现

摘要本文设计并实现了基于Web的销售管理系统,从前景的介绍,到各个模块的介绍,再到系统的设计,最后到系统的测试。简述系统的业务和设计的实现。易销售系统属于后台管理系统,而后台管理系统有不同的侧重点,如页面的美观化,业务流程的易操作化,易发布化。本系统从美观化和易操作化两方面进行,从文档管理需求出发,实现了各个模块增删查改,个别模块的导入和导出。系统由商机模块、客户模块、竞争对手模块、联系

平***苏 2年前 上传534   0

基于web的旅游网站设计与实现

随着经济和交通的快速发展,人们对于生活的追求不再停留在物质层面,而是开始了娱乐和精神层面的追求。旅游是现在大多数人在长假期选择的度过方式。如何快速获取各地最新的旅游信息以获得更好的旅游体验便成为旅游者的需求。

爱***享 3年前 上传1758   0

基于web的驴友社交网站设计与实现

近十年来,随着科技地发展进步,各方面都取得了排山倒海的变化。互联网的七通八达,可以让五湖四海的人们在任何时间和地点进行交流,互联网上的社交似乎成为了主流。所以,以前以实体店为主的旅游社似乎也逐渐消失在潮流之中,旅游社交网站成为了主流,人们不用出门就能规划和准备好一切,旅游网站如春笋般崛起。

爱***享 3年前 上传800   0

基于Java的图书馆座位管理系统的设计与实现

目前,如何利用计算机系统来对座位进行管理是解决占座问题的关键。该图书馆座位管理系统是基于Java架构,采用Eclipse开发工具,使用SSM等前端开源框架,以MySQL为后台数据库,Tomcat服务器下设计与实现。主要功能包括:管理员登录、学生登陆、用户更改密码、管理员管理、管理员对学生管理、管理员对图书管理、学生借书、学生座位预约。

王***朝 3年前 上传1840   0

基于Java的网上购物系统的设计与实现

 XX 学 院 本科毕业论文(设计) 题 目 基于JAVA的网上购物 系统的设计与实现 院 系 计算机科学与技术 专 业_ 计算机科学与技术 (网络工程方向) 姓 名 学 号 学习年限20XX年9月至20XX年7月 指导教师

文***品 5年前 上传2581   0

基于WEB的停车场管理系统设计和实现毕业设计

20XX 届 毕 业 论 文(设计)论文(设计)题目基于WEB的停车场管理系统的设计和实现院系名称计算机科学与技术系专业(班级)计算机科学与技术2005级本科班姓名(学号) 指导教师 系负责人 二O O九年X月X日摘

文***享 3年前 上传698   0

基于WEB的图书管理系统的设计与实现课程设计

软件工程课程设计报告基于WEB的图书信息管理系统的设计与实现所 在 学 院 信息科学技术学院 专 业 名 称 计算机科学与技术 年 级 学生姓名、学号 指导教师姓名、职称

文***享 3年前 上传892   0

Java web期末考试题

姓名:刘晓钰 学号:1330090110 班级:计算机1304 XX大学期末考核2015—2016 学年第2学期 期末考核试卷科目:Java Web 应用开发学院:计信学院专业:计算机科学题号一二三四总分分数一、单选题:(每小题2分,共10分)得分评卷人1.下列

文***品 3年前 上传999   0

基于web的图书管理系统

基于Web的图书管理系统目前,信息时代是这个社会的主旋律,社会的各个区域和领域都因为信息的技术改革而发生了新的变化。跟上时代的步伐,因为整个科技社会的变化和发展很快,增强信息化公司的竞争能力,使企业的现在管理能力的到提高旧的企业内图书借阅信息的管理方法早已经不能让大多数现代企业来实现大数量图书的借阅、统,计和管理,旧的图书管理方法注定被时代抛弃,因此该过程必须实现信息化,于是

平***苏 3年前 上传788   0

基于Web的学生信息管理系统

在现如今这个网络技术高度普及和信息全球化的年代,信息化的程度和互联网技术在国际竞争中充当着重要的角色,华为5G的实例告诉我们,谁先掌握技术谁就有话语权。

平***苏 3年前 上传733   0

基于java的学生信息管理系统

科技带动计算机行业不断地发展,计算机行业的发展也给每个行业带来了巨大的收益,使其工作效率得到提高,同时方便了人们的生活。本系统使用SSM框架,主要采用自顶向下的相关研究的方法。

爱***享 3年前 上传784   0

基于JAVA的医院门诊预约

社会医疗工作和公民的日子息息相关,跟着公民日子水平的前进以及科学技能的前进,人们对医疗条件医疗效劳质量提出了更高的要求。医疗检查是病人获得国家保健服务的第一步,由于旅客交通量迅速增加,传统医院门诊部的登记不能保证医院服务的及时、准确和合理的质量。通过需求分析和技术对比,研究相关资料文献,决定采用基于 SSM(Spring、Spring MVC、MyBatis) 框架搭建系统、 构建系统用B/S结构模式。

爱***享 3年前 上传648   0

基于WEB的二手书销售平台的设计

每到新学期的开始,同学们都要开始购买新书,旧书的处理方式就有点单一了。现如今社会对于绿色文明的倡导力度十分之大,各个地方都在提倡节约用纸,提高纸张再循环利用。可能买一本新书对于学生、家长和一些读者来说,不仅价格较高而且还可能会造成树木资源消耗过大。

爱***享 3年前 上传735   0

毕业论文:基于Web的办公自动化系统设计与实现

基于Web的办公自动化系统设计的主要目的是利用现代的互联网技术,采用人机对话方式为办公人员之间搭建一个互动平台。实现无纸化办公和多部门间协同办公,数据存储安全可靠的要求,在降低办公成本的同时,也极大的提高了员工的办事效率。

z***u 5年前 上传1674   0

基于web的驾校考试管理系统设计与实现

本文主要从驾校考试管理系统的选题,需求分析而出发,根据现有的驾校系统对其进行功能模块设计。系统实现方面,基于B/S架构,而且在开发技术方面使用了jsp使得其开发更为简化,以Tomcat作为服务器。开发完成后对系统进行测试和条数。

平***苏 3年前 上传576   0

0105098基于集成设计和过程技术(IDPT)的产品开发过程管理研究

基于集成设计和过程技术(IDPT)的产品 开发过程管理研究¶ 本文是国家863/CIMS重点应用工程研究课题资助项目 胥悦红· 胥悦红,女,博士 通讯地址(100039)北京市玉泉路19号(甲) 中科院研究生院管理学院。 (中科院研究生院100039) 谢飞 (天津大学管理学院300072) 摘要 本文在将传统的开发过程管理模式与基于IDPT的产品开发过程管理思想进

x***1 13年前 上传18265   0

基于java的坦克大战游戏开发毕业设计

 毕业设计说明书(论文) 作 者: 学 号: 院 系: 专 业: 计算机科学与技术 题 目: 基于java的坦克大战游戏开发 指导者: 实验师

文***品 5年前 上传1308   0

基于java的宠物销售网站的设计与实现

基于Java 的宠物销售网站的设计与实现Design and implementation of java-based pet sales website 日内容摘要本科设计《基于Java 的宠物销售网站的设计与实现》体现了以信息时代的创新购物模式,利用宠物销售网站的不受空间限制,随时随地可以看宠物,买宠物,网络经营的低廉成本等相关特性。使得宠物销售网站对市场

平***苏 10个月前 上传230   0