Complete Guide To Web Development With Java - Understanding Website Creation 2nd Edition Tim Downey PDF For All Chapters
Complete Guide To Web Development With Java - Understanding Website Creation 2nd Edition Tim Downey PDF For All Chapters
com
https://textbookfull.com/product/guide-to-web-
development-with-java-understanding-website-
creation-2nd-edition-tim-downey/
https://textbookfull.com/product/learn-java-for-web-development-
modern-java-web-development-layka-vishal/
textbookfull.com
https://textbookfull.com/product/rocks-and-rifles-the-influence-of-
geology-on-combat-and-tactics-during-the-american-civil-war-scott-
hippensteel/
textbookfull.com
https://textbookfull.com/product/vittorio-benussi-in-the-history-of-
psychology-new-ideas-of-a-century-ago-mauro-antonelli/
textbookfull.com
https://textbookfull.com/product/the-routledge-handbook-of-
translation-studies-and-linguistics-first-published-edition-malmkjaer/
textbookfull.com
https://textbookfull.com/product/ten-laws-for-security-1st-edition-
eric-diehl-auth/
textbookfull.com
Human-Animal Relationships in San and Hunter-Gatherer
Cosmology, Volume I: Therianthropes and Transformation
Mathias Guenther
https://textbookfull.com/product/human-animal-relationships-in-san-
and-hunter-gatherer-cosmology-volume-i-therianthropes-and-
transformation-mathias-guenther/
textbookfull.com
Texts in Computer Science
Tim Downey
Guide to Web
Development
with Java
Understanding Website Creation
Second Edition
Texts in Computer Science
Series Editors
David Gries, Department of Computer Science, Cornell University, Ithaca, NY,
USA
Orit Hazzan , Faculty of Education in Technology and Science, Technion—Israel
Institute of Technology, Haifa, Israel
More information about this series at http://www.springer.com/series/3191
Tim Downey
Guide to Web
Development with Java
Understanding Website Creation
Second Edition
123
Tim Downey
School of Computing
and Information Sciences
Florida International University
Miami, FL, USA
This Springer imprint is published by the registered company Springer Nature Switzerland AG
The registered company address is: Gewerbestrasse 11, 6330 Cham, Switzerland
To Bobbi, my sweetheart, with all my love.
The magic continues.
Preface
This book is about developing web applications. Over the years, more and more
frameworks have appeared that hide the details of the communication between the
browser and the server. These packages are fantastic for developing applications,
but an understanding of the underlying process can help understand the reason that
frameworks do what they do.
In writing this book, I read the Spring documentation in detail and reviewed many
questions from Stack Overflow. The problems I encountered were that many sear-
ches did not return the most current version of documentation. Frequently, I had to
check that I wasn’t reading about version 1 features instead of version 5. Similarly,
many relevant answers to questions are buried deep in the search results, since older
answers have been around much longer and appear at the top of the search.
My hope is that this book will present material from the basics of HTML and
HTTP to the intricacies of web services in a step-by-step manner, adding only a few
details at a time. Some topics have multiple implementations that produce similar
results. I hope that the distinctions between these implementations are made clear.
The book develops a framework in the first few chapters and then switches to the
Spring framework for implementing websites. There are many frameworks on the
market. Spring is popular and Spring Boot is an excellent introductory package.
I want students to understand the actual details that a framework hides, and to use a
framework to solve problems. In the future, when they are introduced to other
frameworks, they will understand them better.
I am grateful to the community of web developers, who have provided all the
excellent tools for creating web applications: Apache, Tomcat, Hibernate, Java
Servlets, Java Server Pages, NetBeans, Eclipse, Log4j, Apache Commons, Google
web services, FedEx web services, PayPal web services, JBoss Community, Spring,
and Maven.
I am thankful to Bobbi, my sweetheart, for all of her love and support. Without
Bobbi, this book would not have been finished. I also want to thank Kip Irvine for
encouraging me to write. Without Kip, this book would not have been started.
vii
Contents
ix
x Contents
2 Controllers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
2.1 Sending Data to Another Form . . . . . . . . . . . . . . . . . . . . . . . . 46
2.1.1 Action Attribute . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
2.1.2 Hidden Field Technique . . . . . . . . . . . . . . . . . . . . . . . 49
2.1.3 Sending Data to Either of Two Pages . . . . . . . . . . . . . 53
2.2 Using a Controller . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
2.2.1 Controller Details . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58
2.2.2 JSP Controller . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
2.2.3 JSPs Versus Servlets . . . . . . . . . . . . . . . . . . . . . . . . . 65
2.2.4 Controller Servlet . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65
2.2.5 Servlet Access . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
2.2.6 Servlet Directory Structure . . . . . . . . . . . . . . . . . . . . . 71
2.2.7 Servlet Engine for a Servlet . . . . . . . . . . . . . . . . . . . . 74
2.3 Maven Goals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74
2.3.1 Automatic Deployment . . . . . . . . . . . . . . . . . . . . . . . . 75
2.3.2 Debugging Servlets . . . . . . . . . . . . . . . . . . . . . . . . . . 78
2.4 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80
2.5 Review . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81
3 Java Beans and Member Variables . . . . . . . . . . . . . . . . . . . . . . . . . 85
3.1 Application: Start Example . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
3.2 Java Bean . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87
3.2.1 Creating a Data Bean . . . . . . . . . . . . . . . . . . . . . . . . . 89
3.2.2 Using the Bean in a Web Application . . . . . . . . . . . . . 90
3.3 Application: Data Bean . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92
3.3.1 Mapping: Data Bean . . . . . . . . . . . . . . . . . . . . . . . . . . 92
3.3.2 Controller: Data Bean . . . . . . . . . . . . . . . . . . . . . . . . . 93
3.3.3 Data Access in a View . . . . . . . . . . . . . . . . . . . . . . . . 94
3.3.4 Views: Data Bean . . . . . . . . . . . . . . . . . . . . . . . . . . . 94
3.4 Application: Default Validation . . . . . . . . . . . . . . . . . . . . . . . . 96
3.4.1 Java Bean: Default Validation . . . . . . . . . . . . . . . . . . . 96
3.4.2 Controller: Default Validation . . . . . . . . . . . . . . . . . . . 98
3.5 Member Variables in Servlets . . . . . . . . . . . . . . . . . . . . . . . . . 100
3.5.1 Threads . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100
3.5.2 The Problem with Member Variables . . . . . . . . . . . . . 100
3.5.3 Local Versus Member Variables . . . . . . . . . . . . . . . . . 103
3.6 Application: Shared Variable Error . . . . . . . . . . . . . . . . . . . . . 104
3.6.1 Controller: Shared Variable Error . . . . . . . . . . . . . . . . 104
3.7 Application: Restructured Controller . . . . . . . . . . . . . . . . . . . . 107
3.7.1 Creating the Helper Base . . . . . . . . . . . . . . . . . . . . . . 108
3.7.2 Creating the Controller Helper . . . . . . . . . . . . . . . . . . 109
3.7.3 Views: Restructured Controller . . . . . . . . . . . . . . . . . . 112
3.7.4 Controller: Restructured Controller . . . . . . . . . . . . . . . 114
Contents xi
Glossary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 503
References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 505
Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 507
Web Applications and Maven
1
This chapter explains how information is sent between a browser and a server. It
begins with descriptions of the request from a browser and a response from a server.
Each has a format that is determined by the Hypertext Transfer Protocol [HTTP].
Basic HTML tags are introduced next, followed by HTML forms for collecting
data. Data is easily passed from one page to another, but the data cannot be
processed without a dynamic engine like a servlet engine. Maven is introduced as a
development environment that easily incorporates a servlet engine into an appli-
cation. Using Maven, a web server can be started that hosts a web application that
can be compiled and run. The chapter explains markup languages, with a detailed
description of the Hypertext Markup Language [HTML], which sends formatted
content from the server to the browser. An important feature of HTML is its ability
to easily request additional information from the server through the use of hypertext
links. HTML forms are covered. These send data from the browser back to the
server. Information from the form must be formatted so that it can be sent over the
web. The browser and server handle encoding and decoding the data.
Simple web pages cannot process form data that is sent to them. One way to
process form data is to use a web application and a Java Server Page [JSP]. In a
JSP, the Expression Language [EL] simplifies access to the form data and can be
used to initialise the form elements with the form data that is sent to the page.
JSPs are processed by a program known as a servlet engine. The servlet engine
receives the request and response data from the web server and processes the
request from the browser. The servlet engine translates all JSPs into programs
known as servlets.
Servlets and JSPs must be run from a servlet engine. Maven has the ability to
embed a Tomcat servlet engine into the application.
Whenever someone accesses a web page on the Internet, two computers commu-
nicate. One computer has a software program known as a browser, the other
computer has a software program known as a web server. The browser sends a
request to the server and the server sends a response to the browser. The request
contains the name of the page that is being requested and information about the
browser that is making the request. The response contains the page that was
requested (if it is available), information about the page, and information about the
server. Figure 1.1 depicts the aspects of the request and response.
When the browser makes the request, it mentions the protocol that it is using:
HTTP/1.1. When the server sends the response, it also identifies the protocol it is
using: HTTP/1.1. A protocol is not a language; it is a set of rules that must be
followed. For instance, one rule in HTTP is that the first line of a request will
contain the type of request, the address of the page on the server and the version of
the protocol that the browser is using. Another rule is that the first line of the
response will contain the version of the protocol that the server is using, a numeric
code indicating the success of the request and a sentence describing the code.
Protocols are used in many places, not just with computers. When the leaders of
two countries meet, they must decide on a common protocol in order to commu-
nicate. Do they bow or shake hands when they meet? Do they eat with chopsticks or
silverware? It is the same situation for computers, in order for the browser and
server to communicate, they must decide on a common protocol.
Fig. 1.1 The request and response have specific formats, as specified by HTTP
1.1 Hypertext Transfer Protocol 3
The request from the browser has the following format in HTTP:
a. The first line contains the type of request, the name of the requested page and
the protocol that is being used.
b. Subsequent lines are the request headers. They contain information about the
browser and the request.
c. A blank line in the request indicates the end of the request headers
d. In a POST request, additional information can be included after the blank line.
Typical information that is contained in the request headers is the brand of the
browser that is making the request, the types of content that the browser prefers, the
languages and character set that the browser prefers and the type of connection that
is being used. The names of these request headers are User-agent, Accept,
Accept-language and Accept-charset, respectively (Table 1.1).
The response from the server has the following format in HTTP:
a. The first line contains the protocol being used, the status code and a brief
description of the status.
b. Subsequent lines are the response headers. They contain information about the
server and the response.
c. A blank line in the response indicates the end of the response headers.
d. In a successful response, the content of the page will be sent after the blank line.
Typical information that is contained in the response headers is the brand of the
server that is making the response, the type of the file that is being returned and the
number of characters that are in the file. The names of these response headers are
Server, Content-Type and Content-length, respectively (Table 1.2).
The server must also identify the type of information that is being sent. This is
known as the Content Type. Different content types define text, graphics, spread-
sheets, word processors and more.
These content types are expressed as Multipurpose Internet Mail Exten-
sions [MIME] types. MIME types are used by web servers to declare the type of
content that is being sent. MIME types are used by the browser to decode the type
of content that is being received. If additional data is included with the request, the
browser uses special MIME types and additional request headers to inform the
server. The server and browser will each contain a file that has a table of MIME
types with the associated file extension for that type.
The basic structure of a MIME type is a general type, a slash and a specific type.
For example, the general type for text has several specific types, for plain text,
HTML text and style sheet text. These types are represented as text/plain, text/html
and text/css, respectively. When the server sends a file to the browser, it will also
include the MIME type for the file in the header that is sent to the browser.
MIME types are universal. All systems have agreed to use MIME types to
identify the content of a file transmitted over the web. File extensions are too
limiting for this purpose. Many different word processor programs might use the
extension .doc to identify a file. For instance, .doc might refer to an MS WORD
document or to an MS WORDPAD document. It is impossible to tell from the
extension which program actually created the program. In addition, other programs
could use the .doc extension to identify a program: for instance, WordPerfect could
also use the .doc extension. Using the extension to identify the content of the file
would be too confusing.
The most common content type on the web is HTML text, represented as the
MIME type text/html.
Some of these would mean that a word was omitted (^), that two letters were
transposed (a sideways '' S ',' enclosing the transposed letters), or that a new para-
graph was needed (a backwards, double-stemmed '' P '). ' These marks were invalu-
able to the teacher who had to correct the paper because they conveyed a lot of
meaning in just a few pen strokes. Imagine if a program could accept such a paper
that is covered with markup, read the markup and generate a new version with all
the corrections made.
There are other forms of markup languages. The script of a play has a markup
language that describes the action that is proceeding while the dialog takes place.
For instance, the following is a hypothetical script for the 3 Stooges:
HTML is the markup language for the web. It is what allows the browser to display
colours, fonts, links and graphics. All markup is enclosed within the angle brack-
ets <and>. Directly adjacent to the opening bracket is the name of the tag. Addi-
tional attributes can be included after the name of the tag and before the closing
bracket.
HTML tags are intermixed with plain text. The plain textis what the viewer of a
web page will see. The HTML tags are commands to the browser for displaying the
Visit https://textbookfull.com
now to explore a rich
collection of eBooks, textbook
and enjoy exciting offers!
6 1 Web Applications and Maven
text. In this example, the plain text ‘This text is strong’ is enclosed within the
HTML tags for making text look strong:
The viewer of the web page would not see the tags, but would see the text
rendered strongly. For most browsers, strong text is bold, and the sentence would
appear as:
This text is strong
HTML has two types of tags: singletons and paired tags.
Singletons have a limited amount of text embedded within them as attributes or
they have no text at all. Singletons only have one tag. Table 1.3 gives two examples
of singleton tags.
Paired tags are designed to contain many words and other tags. These tags have an
opening and a closing tag. The text that they control is placed between the opening and
closing tags. The closing tag is the same as the opening tag, except the tag name is
preceded by a forward slash /. Table 1.4 gives four examples of paired tags.
The html tags enclose all the other tags and text in the document. It only contains
the following two sections.
The head tags enclose tags that inform the browser about how to display the
entire page. These control how the page appears in the browser, but do not
8 1 Web Applications and Maven
contain any content for the page. This paired tag belongs within the paired html
tags.
<body> body tags </body>
The body tags contain all the plain text and HTML tags that are to be displayed
in the browser window. This paired tag belongs within the paired html tags.
While the body section contains the normal HTML tags discussed in this chapter,
like strong and em, the head section contains special markup tags that indicate
how the browser should display the page. The meta and title tags belong in the head
section.
The title tags enclose the text that will display in the title bar of the browser
window.
The meta tag is a singleton that indicates extra information for the browser. This
tag can be repeated to include different information for the browser. A standard
page should include a meta tag with charset='' utf-8 '.' This indicates the character
set for the language that is being used to display the page.
HTML Validation
The WWW Consortium [W3C] publishes the HTML standard and provides tools for
HTML validation that will test that a page has the correct HTML structure. In order
to comply with the HTML specification, all web pages should have the following
structure.
<!DOCTYPE HTML>
<html>
<head>
<meta charset=''utf-8''>
<title>Simple Page</title>
</head>
<body>
<p>
This is a <em>simple</em> web page.
</body>
</html>
a. The DOCTYPE defines the type of markup that is being used. It precedes the
html tag because it defines which version of HTML is being used.
1.2 Markup Language 9
b. All the tags and plaintext for the page are contained within the paired html
tags.
c. The DOCTYPE and meta tags are required if the page is to be validated by W3C
for correct HTML syntax. Go to https://www.w3.org to access the HTML
validator.
There is no excuse for a web page to contain errors. With the use of the vali-
dation tool at https://www.w3.org, all HTML pages should be validated to ensure
that they contain all the basic tags.
Layout versus Style
Two types of information are contained in each HTML page: layout and style. The
basic layout is covered in this chapter; advanced layout and style are covered in
Chap. 7. Style information contains things like the colours and font for the page.
The recommended way to handle style and layout is to place all the layout tags in
the HTML page and to place all the style information in a separate file, called a
style sheet. For the interested student, the HTML and style information from
Chap. 7 can be read at any time.
Hypertext Markup Language Five [HTML5] is the latest version of the HTML
standard. In the previous versions, tags could specify the style of a page. In the new
version, those tags have been deprecated. In order to validate that a page conforms
to version 5, the tags that specify specific style cannot be used.
In previous versions of the HTML standard, different DOCTYPE statements
could be used for HTML pages: strict and transitional. The strict one was the
recommended one, since it enforced the rule that all style information be contained
in a separate file. Version five has no choices for the DOCTYPE: all pages must use
strict HTML. All pages for this book will use the new DOCTYPE for HTML5.
<!DOCTYPE HTML>
single space. In order to insert a new line, tab or multiple spaces in an HTML page,
markup must be used: if it is not plain text, then it must be placed in markup.
Browsers take word wrap one step further. Browsers will compress all con-
secutive white space characters into a single space character. The common white
space characters are the space, the tab and the new line character. If five spaces start
a line, they will be compressed into one space.
The following listing contains a web page that has a poem.
<!DOCTYPE HTML>
<html>
<head>
<meta charset=''utf-8''>
<title>A Poem</title>
</head>
<body>
Roses are red
Violets are blue
This could be a poem
But not a haiku
A haiku has a fixed structure. The first line has five
syllables, the second line has seven syllables and the
third line has five syllables. Therefore, the previous
poem cannot be a haiku.
</body>
</html>
Even though the poem has four lines, the poem will appear as one line in the
browser. This is because no markup was added to indicate that one line has ended
and another line should begin. The browser will wrap to a new line if the poem
would extend beyond the right margin of the browser.
Try It
https://bytesizebook.com/guide-boot/ch1/poem.html
Incidence of Hemolytic Streptococci in Throats of Measles Cases with Reference to Period in Hospital
PERIOD IN MEASLES NO. CASES CULTURED NO. POSITIVE FOR PER CENT POSITIVE FOR
WARD HEMOLYTIC HEMOLYTIC
STREPTOCOCCI STREPTOCOCCI
(Admission) 867 37 4.2
1 week 768 84 10.9
2 weeks 479 109 22.8
3 weeks 240 63 26.2
4 weeks 133 44 33.1
5 weeks 82 26 31.7
6 weeks 53 14 26.4
7 weeks 25 8 32.0
8 weeks 13 1 7.7
9 weeks 9 1 11.1
10 weeks 6 0 0
11 weeks 5 0 0
Table LXIII
PERIOD IN MEASLES NO. CASES CULTURED NO. POSITIVE FOR PER CENT POSITIVE FOR
WARD HEMOLYTIC HEMOLYTIC
STREPTOCOCCI STREPTOCOCCI
1 week 738 67 9.1
2 weeks 424 74 17.4
3 weeks 195 34 17.4
4 weeks 92 16 17.4
5 weeks 46 7 15.2
6 weeks 26 4 15.4
7 weeks 14 3 21.4
8 weeks 8 0
9 weeks 5 0
10 weeks 4 0
11 weeks 3 0
A comparison of Tables LXII and LXIII gives some indication of what might have been expected if the
carriers had not been removed from the treatment wards at weekly intervals. With the carriers removed
from the “clean” cases and segregated in a separate ward so as to be removed effectively as sources of
spread of the S. hemolyticus infection to clean cases, the percentage incidence with all cases considered
rose to a point nearly twice as high as that ever reached in the wards where clean cases alone were
allowed to remain. Had these carriers not been separated, and remained in contact with cases free from
hemolytic streptococci, they would have served as just so many more sources of infection, and an
incidence of at least twice that recorded for all cases combined, or four times that of the treatment
wards, might have been expected. These results indicate that the weekly separation of carriers from
clean cases did, to a considerable extent, lower the individual’s danger of acquiring S. hemolyticus
infection while in the hospital.
Complications of Measles
In Table LXIV the complications developing in the measles patients under observation at Camp Pike
are tabulated. In the division of the complications developing in “carriers” and “noncarriers” of the
hemolytic streptococci, reference is made only to the records of the throat cultures. The division is
therefore not dependent upon the bacteriology of the complications. For example, only 9 of the 12
cases of pneumonia developing in “carriers” were streptococcus pneumonias. On the other hand, the
cases of mastoiditis following otitis media were almost invariably due to hemolytic streptococci. Of the
10 otitis cases occurring in “noncarriers,” 4 developed mastoiditis and 3 of these showed hemolytic
streptococci on culture from the mastoid cells at operation. Missed cases of identification of S.
hemolyticus by throat culture in cases which develop S. hemolyticus complications may arise from a
number of causes. It is desired here only to direct attention to these discrepancies.
Pneumonia Following Measles.—Fifty-six cases of pneumonia following measles occurred during
the period of observation in this group of 867 cases of measles. Of these, 9 were streptococcus
pneumonias. This gives an incidence for streptococcus pneumonias of 1.04 per cent, while that for all
the pneumonia is 6.4 per cent. There were 8 cases of lobar and 48 cases of bronchopneumonia.
Seventeen fatal cases occurred giving a mortality rate of 30.4 per cent for the group. Five of these fatal
cases occurred among the 9 streptococcus pneumonias. The mortality rate for the streptococcus
pneumonia thus was 55.5 per cent; that for the nonstreptococcus group was 25.5 per cent. All 9 cases
of streptococcus pneumonia developed empyema. In 7 cases it was diagnosed clinically; in 2 at autopsy
only. No cases of empyema developed in the group of nonstreptococcus pneumonias.
Table LXIV
Complications Developing in 867 Cases of Measles at Camp Pike. Distribution of Complications Between 242 “Carriers” and 625 “Noncarriers” of Hemolytic
Streptococci from September 15 to December 15, 1918
Note.—The percentages of incidence of pneumonia and otitis media in the “carrier” and “noncarrier” groups are at direct variance. It would appear from these findings
that streptococci very readily invade the middle ear from the throat and set up grave disorders. The invasion of the lung from the throat occurs with less frequency.
Hemolytic streptococci perhaps never initiate the pneumonic processes and can be regarded as more or less accidental secondary invaders.
The relation of these pneumonias following measles, to the influenza epidemic has been discussed.
The time relations between the onsets of measles and that of the subsequent pneumonia vary widely.
There appears to be nothing constant in the length of time between the onset of measles and that of
the pneumonia. In 30 of the cases this period is less than ten days; in the remaining 26 cases, it ranges
from ten to thirty-two days (Chart 4).
In the ward treatment of these cases of pneumonia, they were divided into three groups according to
their clinical characters and according to the results of throat and sputum cultures.
( a) Streptococcus pneumonias 9 cases
(b) Pneumonia with hemolytic streptococci in the throat without symptoms referable to the streptococcus 13 cases
( c) Pneumococcus pneumonias not carrying hemolytic streptococci 34 cases
The streptococcus-free cases were treated in a separate ward. Cases were admitted to this ward
directly from the “clean” measles wards, but only after a throat culture taken prior to their transfer had
been negative for the hemolytic streptococcus.
The other two groups were treated together in another ward, but in strictly separate compartments of
it. This precaution was carried out on the assumption that patients with an acute streptococcus
pneumonia were real sources of danger in the ward because of a heightened virulence of the organism
causing the grave symptoms. The pneumonias subsequently developing hemolytic streptococci in their
throats, without their presence modifying the course of the pneumonia, came to be regarded as being
in the same class with uncomplicated cases of measles carrying hemolytic streptococci, in so far as their
being potential sources of danger in a ward is concerned.
In this series of cases (Chart 5) the appearance of S. hemolyticus in the throat and the onset of otitis
media are very closely associated in those patients in whom further extensions of the streptococcus
infection occurred. In instances in which appearance of streptococci and of otitis media are separated
by an interval of more than seven days, no further extension occurred. In 8 cases in which this interval
is seven days or less there has been no further extension of the infection.
The Dissemination of Hemolytic Streptococci in Wards
Beginning October 24 cultures for the identification of carriers of hemolytic streptococci were made
from all patients in a ward and repeated at intervals of one week. Prior to this time individual patients
had been examined at intervals of one week, so that an entire ward was never studied on any particular
day. This system did not identify and remove all “carriers” in a ward at a given time and was abandoned
because it failed to show the conditions present. Investigation of wards as units proved much more
satisfactory.
The studies made in four of the double wards used for the care of patients with measles are
presented in Table LXV. During the time of this study hemolytic streptococci were more prevalent than
at an earlier period.
Cultures from the throats of all patients entering these wards were negative for S. hemolyticus on
admission. The table showing the incidence of “carriers” of hemolytic streptococci each week in these
wards demonstrates:
1. The separation of “carriers” and “noncarriers” by throat culture made on admission does not
prevent the increase of streptococcus “carriers” in wards.
2. Removal of all “carriers” found by cultures on admission and at weekly intervals is inadequate.
Table LXV
Hemolytic Streptococci in Throats of Normal Men Not Resident in the Base Hospital
Table LXVII
Results of Throat Cultures in 242 Hospital Patients Identified as “Carriers” of Hemolytic Streptococci; Cultures Taken at Weekly Intervals
GROUP 1st 2nd 3rd 4th 5th 6th 7th 8th 9th 10th 11th 12th No. of No. with
Culture Culture Culture Culture Culture Culture Culture Culture Culture Culture Culture Culture Contact Acute Hem
“Carriers.” Strep.
Complicatio
I 37 Cases
+ 7
+ + 7
+ + + 6
+ + + + 2
+ − 8
+ − − 1
+ − − − − 1
+ + − 1
+ − + 2
+ − − − − + + + 1
+ + − − + + + 1
II 67 Cases
− + 26
− + + 12
− + + + 2
− + − 9
− + − − 0
− + + − 2
− + + + + − − + − 1
− + − + 2
III 74 Cases
− − + 38
− − + + 5
− − + + + 4
− − + + + + 0
− − + − − − 0
− − + − 4
− − + + − − − − 1
− − + + − 0
− − + + − − − 1
− − + + + + − 0
− − + − + 1
− − + − + + 2
− − + − + + + 1
− − + − − + + 1
− − + + + − − + 1
IV 34 Cases
− − − + 12
− − − + + 5
− − − + + + 4
− − − + − 3
− − − + − − 1
− − − + + − 1
− − − + + + − 1
− − − + − − + + 1
− − − + + − − − − − 0
V 16 Cases
− − − − + 1
− − − − + + 1
− − − − + − 3
− − − − + − − − 0
− − − − + − − − − − 1
− − − − + + − 1
− − − − + − + 2
− − − − + + − + 1
− − − − + + − − − + 1
VI 7 Cases
− − − − − + 1
− − − − − + + 2
− − − − − + − 3
− − − − − + − − 1
VII 4 Cases
− − − − − − + 2
− − − − − − + + 1
− − − − − − + − − − − − 1
VIII 3 Cases
− − − − − − − + 2
− − − − − − − + + + 1
(b) Eleven of the patients entering as positives became negative, 10 after one week and 1 after two
weeks.
This group of cases furnishes no data concerning the duration of the “carrier” state, since all cases
were positive when first observed. In 30 per cent of instances, hemolytic streptococci disappeared
within the first two weeks of observation.
Groups II to VIII include 205 patients who became positive at some time during their stay in the
hospital. The arrangement in groups depends upon the length of time the patients remained in the
hospital before acquiring S. hemolyticus. Ninety-five of these patients had no further cultures after the
initial positive culture. Fourteen appear as “irregular,” as defined above. These two classes of cases are
omitted in the following summary of these groups. The initial positive culture is arbitrarily considered
the day of infection and subsequent cultures mark off weekly intervals.
(a) Thirty-nine patients had acute infections due to hemolytic streptococci. Thirteen of these patients
passed from observation after their initial positive culture. The cases with repeated cultures after initial
positive may be summarized as in Table LXIX.
Table LXIX
Eugene L. Opie, M.D.; Francis G. Blake, M.D.; James C. Small, M.D.; and Thomas M. Rivers, M.D.
Among 18 autopsies upon men who have died with pneumonia following measles there are
pulmonary lesions representing almost every type of pneumonia which has been found in association
with influenza. In most instances pneumonia made its appearance during the second week of measles
and death occurred during the third week. Of 16 instances in which the record is definite, pneumonia
had its onset during the first week of measles in 4 instances, during the second week in 11 instances,
and in one instance (Autopsy 390) perhaps not referable to measles in the fifth week. The duration of
pneumonia varied from three to thirty-two days; in 10 instances it did not exceed one week, in 5
instances it was between one and two weeks and in one instance, thirty-two days. When the duration of
pneumonia exceeded ten days some evidence of chronic pulmonary disease was found at autopsy.
The same lack of correspondence between clinical diagnosis and pulmonary lesions noted with
influenza was found following measles. In accordance with the prevailing opinion concerning the
character of pneumonia following measles, the diagnosis of bronchopneumonia was made in 13
instances and in all of these cases bronchopneumonia was found at autopsy. The diagnosis of lobar
pneumonia was made 5 times and was correct only once. Nevertheless, lobar pneumonia was present 4
times, but was recognized only once (Autopsy 486.) Failure to recognize lobar pneumonia, was
doubtless due in part at least to its association with purulent bronchitis and peribronchiolar pneumonia
(Table LXXI).
NO. OF RACE LENGTH DURATION DURATION CLINICAL PURULENT LOBAR PERIBRONCHIOLAR HEMORRHAGIC
AUTOPSY OF OF OF DIAGNOSIS BRONCHITIS PNEUMONIA CONSOLIDATION PERIBRONCHIOLAR
MILITARY ILLNESS PNEUMONIA CONSOL.
SERVICE
390 W 1m. 35 6 L M
441 W 1m. 16 11 B P + +
442 W 1m. 17 2+ L P M
443 W 21d. 23 14 B P +
444 W 1m. 9 3 B P M +
450 W 29d. 19 5 B + M
453 W 36d. 13 6 B P +
481 W 54d. 4+ 3? B P +
484 W 42d. 20 7 B P +
486 C 6d. 17 8 L P +
491 W 2m. 19 5 B +
496 W 1m. 43 32 L P +
505 C 4m. 16 6 B P +
507 C 5m. 14 3 B
508 C 2m. 16 5 B + M
Changes in Bronchi.—The changes in the bronchi do not differ in character from those associated
with pneumonia following influenza. Purulent bronchitis recognized at autopsy by the presence of
mucopurulent material in the small bronchi was found in a much larger proportion of instances in this
group of autopsies occurring in 13 of 18 instances (72.2 per cent), whereas it was present in only 55.6
per cent of autopsies on individuals with pneumonia following influenza. There was peribronchial
hemorrhage recognizable on gross examination in 3 autopsies and microscopically in 3 additional
instances.
Bronchiectasis was present in a considerable proportion of these autopsies, dilatation of bronchi being
noted in 7, but it was usually moderately advanced and at times limited to the bases of the lungs. The
short duration of respiratory disease perhaps explains the infrequency of advanced bronchiectasis. The
incidence of the lesion is greater with measles (43.7 per cent) than with influenza (22.4 per cent).
Microscopic changes in the bronchi do not differ from those found after influenza. Evidence of acute
inflammation, often hemorrhagic in character, is found within the lumen of the bronchus and in the
tissues immediately in contact with the lumen. Not infrequently the epithelium is lost; there is superficial
necrosis and deposition of fibrin upon the surface and within the tissue. In the deeper tissues of the
bronchial wall there is infiltration with lymphoid and plasma cells, which in the larger bronchi is
particularly advanced about the mucous glands of which the acini exhibit degenerative changes. With
the onset of chronic changes new formation of fibrous tissue occurs in the wall of the bronchus and in
the contiguous interalveolar walls. The lining epithelium often loses its columnar cells and assumes a
squamous type.
Changes in the bronchi with bronchiectasis have been similar to those following influenza. Weakening
of the wall permitting dilatation is brought about by necrosis extending outward from the lumen a
varying distance into the bronchial wall and permitting the formation tears which diminish resistance to
intrabronchial pressure.
Lobar Pneumonia.—Lobar pneumonia following measles occurred in 4 instances. Onset in these
cases was on approximately the 9th, 10th, 11th, or 14th day of measles; the onset of
bronchopneumonia bore a similar time relation to the onset of measles, the average interval being nine
days. Hepatization with lobar pneumonia was in 1 instance red, in 3 instances gray, and in all save 1
instance the consolidation was firm and coarsely granular on section. In the exceptional instance the
greater part of the right upper lobe was laxly consolidated and rather finely granular but the microscopic
appearance was in all instances that of lobar pneumonia. Lobar pneumonia in 2 of these cases was
associated with purulent bronchitis present in parts of the lung that had not undergone consolidation,
whereas in the other 2 instances there were acute bronchitis and peribronchiolar pneumonia recognized
by microscopic examination.
In one instance hepatization of the lung presented some noteworthy features.
Autopsy 450.—G. D., white, aged twenty-one, a farmer, resident of Arkansas, had been in military service twenty-nine
days. Onset of illness began on October 2, nineteen days before death, and on admission on the same day the diagnosis of
measles was made. Signs of pneumonia, regarded as bronchopneumonia, were recognized five days before death. Three
days later there was otitis media and paracentesis was performed. On October 3 and 10 neither S. hemolyticus nor B.
influenzæ was found in the sputum; on October 17 and 20 S. hemolyticus was not found but B. influenzæ was present.
Anatomic Diagnosis.—Acute lobar pneumonia with gray and red hepatization in right upper and lower lobes; edema and
peribronchial hemorrhage in left lung.
The entire lower lobe of the right lung (Fig. 29) with the exception of a narrow air-containing zone in contact with basal
surface is firmly consolidated. The greater part of the consolidated tissue is yellowish gray, firm and coarsely granular. The
uppermost part of the consolidated tissue is softer than elsewhere as if it has undergone autolysis. The lowermost part of
the consolidated tissue in a zone from 2.5 to 3.5 cm. in breadth is firmly consolidated but deep red. The bronchi contain stiff
plugs of fibrin. In the upper lobe continuous with the consolidated part of the lower is a semicircular patch of yellowish gray
consolidation. It overlies the line of the interlobular cleft at the site of a break in its continuity. Consolidation appears to have
spread from the lower lobe into the upper at the site where the alveolar tissue of the two lobes is continuous but is absent
from that part of the upper lobe separated from the lower by the interlobular cleft. This semicircular patch of yellowish gray
consolidation is separated from air containing tissue of the upper lobe by a zone of red hepatization about 1 cm. in thickness.
Bacteriologic examination showed the presence of Pneumococcus IV in the blood of the heart; B. influenzæ alone was
obtained from the right lower lobe and B. influenzæ and staphylococcus from the left main bronchus.
The distribution of lobar pneumonia in the foregoing autopsy indicates that it has spread like a wave
from the upper part of the lower lobe (Fig. 32) penetrating into the upper where the alveolar tissue of
the two lobes is in contact; gray hepatization is everywhere separated from air containing tissue by an
advancing zone of red hepatization.
It may be assumed that lobar pneumonia was caused by Pneumococcus II atypical in 3 instances
although it was recovered from the lungs only twice, for in the third instance (Autopsy 486) it was found
in the bronchus and in the inflamed pleural cavity; pneumococci were doubtless previously present in
the lung, but had disappeared at least from that part from which the culture was made. Pneumococcus
IV was evidently the cause of pneumonia in 1 instance (Autopsy 450), for it was found in the blood of
the heart although it was absent in the culture from the lung.
Little significance can be attributed to the observation that B. influenzæ was present in pure culture in
the lungs from Autopsies 450 and 486, for the presence of Pneumococci IV in the blood of the heart in
Autopsy 450 and of Pneumococcus II atypical in the pleura in Autopsy 486 furnishes evidence in view of
the occurrence of lobar pneumonia that pneumococci had disappeared from the lungs. B. influenzæ was
found both in the lungs and bronchus or in the bronchus alone in 3 of these 4 cases.
The relation of hemolytic streptococci to the lesion is of interest. In 3 of 4 instances of lobar
pneumonia this microorganism had entered the bronchi but was not found in the lungs or in the heart’s
blood; and gross and histologic examination showed none of the lesions which are usually caused by it.
In 1 instance (Autopsy 508) hemolytic streptococci, absent from the throat when the patient was
admitted to the hospital with measles sixteen days before death, appeared in a culture made five days
later and was subsequently found three times; it had penetrated into the bronchus but failed to reach
the lung. Observations made upon lobar pneumonia following influenza have shown the relative
insusceptibility of lobar pneumonia with gray hepatization to secondary infection with hemolytic
streptococci (p. 160). Autopsy 508 demonstrates that occurrence of hemolytic streptococci in the
sputum of a patient with pneumonia does not furnish conclusive proof of the existence of streptococcus
pneumonia.
Bronchopneumonia.—Bronchopneumonia has been found in every instance of pneumonia following
measles save 3, namely in Autopsy 486, Autopsy 505 with lobar pneumonia and Autopsy 507 with
interstitial suppurative pneumonia. It is not improbable that further histologic study might have
demonstrated small patches of peribronchiolar pneumonia, for purulent bronchitis was present in the
two autopsies with lobar pneumonia. This small group of cases has reproduced all of the important
features of bronchopneumonia following influenza. Hemorrhagic peribronchiolar consolidation
characterized by the presence of small gray spots clustered about terminal bronchi upon a
homogeneously red background has been found in 5 of 18 instances of pneumonia with measles.
Pfeiffer regarded this lesion as characteristic of the pneumonia of influenza. Peribronchiolar patches of
consolidation with no surrounding hemorrhage were found in 14 instances, being recognized first by
microscopic examination in half of this number. Lobular consolidation occurred in 11 autopsies and
peribronchial fibrinous pneumonia was present in a third of the autopsies on patients with pneumonia of
measles.
Bronchial, peribronchial and intraalveolar hemorrhage is much more commonly associated with the
pneumonias of influenza than with the more familiar types of acute bronchopneumonia. Exuded blood
may undergo absorption; and with bronchopneumonia which, persisting unresolved, has assumed the
characters of a chronic lesion, it is common to find mononuclear cells often in great abundance filled
with brown pigment derived from the hemoglobin of red blood corpuscles.
Autopsy 439 is an example of acute hemorrhagic bronchopneumonia; there are red lobular and
confluent lobular patches of consolidation which upon the pleural surface have a blue or purplish color.
In the dependent part of the left lung occupying a large part of the lower lobe there is lax, red
consolidation marked by gray or yellowish gray spots of peribronchiolar pneumonia and in this lobe
bronchi are encircled by zones of hemorrhage. Pneumococcus II atypical was obtained from the lung. In
Autopsy 444 the lesion has the same hemorrhagic character although lobular patches are in a stage of
grayish red hepatization. Pneumococcus II atypical has been found in the heart’s blood, and with B.
influenzæ in lungs and bronchus. Autopsy 441 is an example of the occurrence of conspicuous nodules
of peribronchiolar consolidation in some parts of the lungs with the same lesion in other parts on a
background of hemorrhage. B. influenzæ and S. aureus have been found in both lungs and bronchi.
Steinhaus[102] states that the pneumonia of measles is never lobular inflammation but occurs in small
patches several of which may be found in a single lobule.
Chronic fibroid pneumonia following measles characterized by cellular infiltration and proliferation of
the interstitial tissue of the lung has been described by Bartels,[103] Steinhaus,[104] Hart,[105]
MacCallum[104] and others.
With acute bronchopneumonia following measles the average duration of pneumonia, determined by
the date upon which physical signs of pneumonia were first recognized and in consequence subject to
some error, was seven days; in instances of chronic bronchopneumonia the average duration of
pneumonia has been fifteen days.
The bacteriology of acute bronchopneumonia following measles is shown in Table LXXII.
Table LXXII