1448
1448
_____ Follow the link below to get your download now _____
https://ebookball.com/product/a-comparative-study-of-web-
application-design-models-using-the-java-technologies-1st-
edition-by-budi-kurniawan-jingling-xue-
isbn-3540213710-978-3540213710-12688/
Java for the Web with Servlets JSP and EJB 1st edition by
Kurniawan Budi ISBN 073571195X 9780735711952
https://ebookball.com/product/java-for-the-web-with-servlets-jsp-and-
ejb-1st-edition-by-kurniawan-budi-isbn-073571195x-9780735711952-12630/
https://ebookball.com/product/web-animation-using-javascript-develop-
and-design-1st-edition-by-julian-shapiro-
isbn-0134096703-9780134096704-16170/
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, Model
2, 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-use 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 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 [5]. This technology gains its popularity
from its superiority over other technologies such as CGI and PHP [2], [3], [13].
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) [4]. 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 Java-
based Web applications 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 [12], and JSF [6]. 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
J.X. Yu, X. Lin, H. Lu, and Y. Zhang (Eds.): APWeb 2004, LNCS 3007, pp. 711–721, 2004.
© Springer-Verlag Berlin Heidelberg 2004
712 B. Kurniawan and J. Xue
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 Model-View-Controller 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 JSR-127.
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 ready-to-use components such as extensible UI components, easy page
navigation, input validators, data converters and JavaBeans management.
The problem 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 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 code,
the 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.
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 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
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-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 browser's scripting feature is
being on and malicious users can easily work around client-side validation.
A Comparative Study of Web Application Design Models 713
− 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 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 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 to be displayed after the current request is determined by the value of
a specified request parameter. Managing page navigation is critically important.
3.1 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.
3.2 Struts
3.3 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
ready-to-use 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 event-driven. For page navigation, JSF uses an approach
similar to Struts, i.e., by allowing navigation rules to be defined in an application
configuration file (again, an XML document).
What distinguishes a JSF application from non-JSF servlet/JSP application is that
JSF applications are event-driven. 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 servlet/JSP 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.
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.
A Comparative Study of Web Application Design Models 715
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 5.02 [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.
For performance testing, we emulate multiple users using JMeter 1.9 [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 hits/seconds the server is capable of serving.
4.4 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.
716 B. Kurniawan and J. Xue
5 Experimental Results
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
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, i.e. by utilising an Application
Configuration file. The other classes in JSF are a ContextListener, an ActionListener,
and a Database utility class.
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 sub-sections.
Search Operation
1000
Model 2
900
Struts
800 JSF
Server Response Time (ms)
700
600
500
400
300
200
100
0
1 2 3 4 5 6 7 8 9 10
Number of Concurrent Users
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 is 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.
718 B. Kurniawan and J. Xue
Therefore, given an action request parameter, the next page of navigation is obtained
through a look-up. 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.
Browse Operation
1200
Model 2
Server Response Time (ms)
1000 Struts
JSF
800
600
400
200
0
1 2 3 4 5 6 7 8 9 10
Number of Concurrent Users
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.
Shopping Operation
2500
Model 2
1500
1000
500
0
1 2 3 4 5 6 7 8 9 10
Number of 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
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 2.3 Specification does not define any
caching mechanism. There is no mention of caching in the upcoming Servlet 2.4
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 semi-static 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 2.The main drawback is that the page navigation rules are hard-coded in the
Controller servlet. This means any minor change to the program flow will require
the Controller servlet to be re-compiled. 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, i.e. the first time the servlet is loaded into memory.
If the properties file needs to be re-read 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 re-constructed. 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 time-consuming for
A Comparative Study of Web Application Design Models 721
every 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 non-JSF servlets/JSP pages.
JSF is event-driven. JSF programmers determine the behavior of a JSF application
by writing event listeners, just like those listeners in a Swing application. In JSF
version 1.0, 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.
References
Author: C. G. Jung
Language: German
C. G. Jung
Dr. med. et jur., vorm. Dozent der
Psychiatrie an der Universität Zürich
Nachdruck verboten.
Alle Rechte, insbesondere das der Übersetzung, vorbehalten.
Copyright 1921 by Rascher & Cie., Verlag, Zürich.
Buchdruckerei Hans Schatzmann, Horgen-Zürich.
Inhalt.
Einleitung: Seite
Die zwei Mechanismen der Extra-
und der Introversion. Die vier
psychologischen Grundfunktionen:
Denken, Fühlen, Empfinden und
Intuieren 7
I. Das Typenproblem in
der antiken und 17
mittelalterlichen
Geistesgeschichte:
1. Zur Psychologie in der Antike.
Tertullian und Origenes 17
2. Die theologischen Streitigkeiten
der alten Kirche. Homousie und
Homoiusie. Der pelagianische
Streit 33
3. Das Problem der
Transsubstantiation 36
4. Nominalismus und Realismus 40
a) Das Universalienproblem in
der Antike.
b) Das Universalienproblem in
der Scholastik.
c) Der Einigungsversuch des
Abaelard.
5. Der Abendmahlstreit zwischen
Luther und Zwingli 91
X. Allgemeine 473
Beschreibung der Typen
A. Einleitung.
B. Der extravertierte Typus. 477
I. Die allgemeine Einstellung des
Bewusstseins 478
II. Die Einstellung des
Unbewussten 483
III. Die Besonderheiten der
psychologischen
Grundfunktionen in der
extravertierten Einstellung 490
1. Das Denken. 2. Der
extravertierte Denktypus. 3.
Das Fühlen. 4. Der
extravertierte Fühltypus. 5.
Zusammenfassung der
rationalen Typen. 6. Das
Empfinden. 7. Der
extravertierte
Empfindungstypus. 8. Die
Intuition. 9. Der extravertierte
intuitive Typus. 10.
Zusammenfassung der
irrationalen Typen.
C. Der introvertierte Typus. 535
I. Die allgemeine Einstellung des
Bewusstseins 535
II. Die unbewusste Einstellung 542
III. Die Besonderheiten der
psychologischen
Grundfunktionen in der
introvertierten Einstellung 545
1. Das Denken. 2. Der
introvertierte Denktypus. 3.
Das Fühlen. 4. Der
introvertierte Fühltypus. 5.
Zusammenfassung der
rationalen Typen. 6. Das
Empfinden. 7. Der introvertierte
Empfindungstypus. 8. Die
Intuition. 9. Der introvertierte
intuitive Typus. 10.
Zusammenfassung der
irrationalen Typen. 11.
Hauptfunktion und
Hilfsfunktion.
Schlusswort 693
Vorrede.
Dies Buch ist die Frucht einer beinahe zwanzigjährigen Arbeit im
Gebiete der praktischen Psychologie. Es ist gedanklich allmählich
entstanden, einmal aus unzähligen Eindrücken und Erfahrungen der
psychiatrischen und nervenärztlichen Praxis sowohl, wie des
Umganges mit Menschen aller sozialen Schichten, sodann aus
meiner persönlichen Auseinandersetzung mit Freund und Feind, und
schliesslich aus der Kritik der psychologischen Eigenart meiner
selbst. Ich habe mir vorgenommen, den Leser nicht mit Kasuistik zu
beschweren, dagegen lag es mir daran, meine aus der Erfahrung
abstrahierten Gedanken historisch sowohl wie terminologisch der
bereits vorhandenen Erkenntnis anzugliedern. Ich habe dieses
Unternehmen weniger aus einem Bedürfnis historischer
Gerechtigkeit durchgeführt, als vielmehr in der Absicht, die
Erfahrungen des ärztlichen Spezialisten aus dem engen Fachgebiete
in allgemeinere Zusammenhänge zu bringen; in Zusammenhänge,
welche es auch dem gebildeten Laien ermöglichen, sich die
Erfahrungen eines Spezialgebietes zu nutze zu machen. Ich hätte
diese Angliederung, die man leicht als einen Eingriff in andere
Gebiete missverstehen könnte, niemals gewagt, wenn ich nicht der
Überzeugung wäre, dass die in diesem Buche dargestellten
psychologischen Gesichtspunkte von allgemeiner Bedeutung und
Anwendbarkeit sind, und darum auch besser in einem allgemeinen
Zusammenhang abgehandelt, als in der Form einer
fachwissenschaftlichen Hypothese belassen werden. Dieser meiner
Absicht entsprechend habe ich mich darauf beschränkt, mich mit den
Ideen einzelner Bearbeiter des vorliegenden Problems
auseinanderzusetzen, und habe darauf verzichtet, alles zu erwähnen,
was überhaupt schon zu unserer Frage gesagt wurde. Ganz
abgesehen davon, dass es meine Kraft um ein Vielfaches überstiege,
eine auch nur annähernde Vollständigkeit eines solchen
Verzeichnisses von einschlägigen Materialien und Meinungen zu
erreichen, trüge eine solche Sammlung auch gar nichts Gründliches
bei zur Erörterung und Entwicklung des Problems. Ich habe darum
vieles, was ich mir im Laufe der Jahre gesammelt habe, ohne
Bedauern weggelassen und mich möglichst auf die Hauptsachen
beschränkt. Diesem Verzicht ist auch ein wertvolles Dokument, das
mir sehr viele Hilfe gewährte, zum Opfer gefallen. Dies ist ein
umfangreicher Briefwechsel mit meinem Freunde, Herrn Dr. med. H.
Schmid in Basel, den ich mit ihm über die Typenfrage gepflogen
habe. Ich verdanke diesem Meinungsaustausch sehr viel Klärung,
und vieles daraus ist auch in allerdings veränderter und mehrfach
überarbeiteter Form in mein Buch übergegangen. Im wesentlichen
gehört dieser Briefwechsel zu den Vorarbeiten, deren Mitteilung
mehr Verwirrung als Klarheit erzeugen würde. Ich bin es aber den
Bemühungen meines Freundes schuldig, ihm an dieser Stelle meinen
Dank auszusprechen.
Küsnacht-Zürich.
Im Frühling 1920.
Dr. C. G. Jung.
Einleitung.
Plato und Aristoteles! Das sind nicht bloss die zwei Systeme, sondern
auch die Typen zweier verschiedener Menschennaturen, die sich seit
undenklicher Zeit, unter allen Kostümen, mehr oder minder feindselig
entgegenstehen. Vorzüglich das ganze Mittelalter hindurch, bis auf den
heutigen Tag, wurde solchermassen gekämpft, und dieser Kampf ist der
wesentlichste Inhalt der christlichen Kirchengeschichte. Von Plato und
Aristoteles ist immer die Rede, wenn auch unter anderm Namen.
Schwärmerische, mystische, platonische Naturen offenbaren aus den
Abgründen ihres Gemütes die christlichen Ideen und die entsprechenden
Symbole. Praktische, ordnende, aristotelische Naturen bauen aus diesen
Ideen und Symbolen ein festes System, eine Dogmatik und einen Kultus.
Die Kirche umschliesst endlich beide Naturen, wovon die einen sich
meistens im Klerus und die andern im Mönchstum verschanzen, aber sich
unablässig befehden.
(H. Heine: Deutschland, I.)
Our website is not just a platform for buying books, but a bridge
connecting readers to the timeless values of culture and wisdom. With
an elegant, user-friendly interface and an intelligent search system,
we are committed to providing a quick and convenient shopping
experience. Additionally, our special promotions and home delivery
services ensure that you save time and fully enjoy the joy of reading.
ebookball.com