Java EE 5 Development with NetBeans 6 1st Edition Heffelfinger download
Java EE 5 Development with NetBeans 6 1st Edition Heffelfinger download
https://ebookultra.com/download/java-ee-5-development-with-
netbeans-6-1st-edition-heffelfinger/
https://ebookultra.com/download/java-ee-5-development-using-glassfish-
application-server-1st-ed-edition-david-heffelfinger/
https://ebookultra.com/download/big-java-compatible-with-
java-5-6-and-7-4th-edition-cay-s-horstmann/
https://ebookultra.com/download/the-java-ee-6-tutorial-basic-
concepts-4th-edition-eric-jendrock/
https://ebookultra.com/download/java-ee-7-essentials-1st-edition-arun-
gupta/
Java EE 7 for Beginners 1st Edition Sharanam Shah
https://ebookultra.com/download/java-ee-7-for-beginners-1st-edition-
sharanam-shah/
https://ebookultra.com/download/pro-netbeans-ide-6-rich-client-
platform-edition-adam-myatt/
https://ebookultra.com/download/starting-out-with-java-early-
objects-5-e-5th-edition-tony-gaddis/
https://ebookultra.com/download/agile-web-development-with-
rails-5-1st-edition-sam-ruby/
https://ebookultra.com/download/jboss-r-seam-simplicity-and-power-
beyond-java-tm-ee-1st-edition-michael-juntao-yuan/
Java EE 5 Development with NetBeans 6 1st Edition
Heffelfinger Digital Instant Download
Author(s): Heffelfinger, David
ISBN(s): 9781847195463, 1847195466
Edition: 1
File Details: PDF, 23.45 MB
Year: 2008
Language: english
Java EE 5
Development with NetBeans 6
David R. Heffelfinger
BIRMINGHAM - MUMBAI
This material is copyright and is licensed for the sole use by Henry Vanyan on 26th July 2009
7406 Valaho Dr, , Tujunga, , 91042
Java EE 5 Development with NetBeans 6
All rights reserved. No part of this book may be reproduced, stored in a retrieval
system, or transmitted in any form or by any means, without the prior written
permission of the publisher, except in the case of brief quotations embedded in
critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy of
the information presented. However, the information contained in this book is sold
without warranty, either express or implied. Neither the author, Packt Publishing,
nor its dealers or distributors will be held liable for any damages caused or alleged to
be caused directly or indirectly by this book.
Packt Publishing has endeavored to provide trademark information about all the
companies and products mentioned in this book by the appropriate use of capitals.
However, Packt Publishing cannot guarantee the accuracy of this information.
ISBN 978-1-847195-46-3
www.packtpub.com
This material is copyright and is licensed for the sole use by Henry Vanyan on 26th July 2009
7406 Valaho Dr, , Tujunga, , 91042
Credits
This material is copyright and is licensed for the sole use by Henry Vanyan on 26th July 2009
7406 Valaho Dr, , Tujunga, , 91042
About the Author
I would also like to thank the technical reviewers, David Salter and
Mario Pérez Madueño; your feedback certainly was essential, greatly
improving the quality of the material presented in the book.
Last, and most certainly not least, I would like to thank my wife and
daughter for enduring the long hours I spent working on the book,
unable to spend time with my family.
This material is copyright and is licensed for the sole use by Henry Vanyan on 26th July 2009
7406 Valaho Dr, , Tujunga, , 91042
About the Reviewers
David Salter is an enterprise software architect who has been developing software
professionally since 1991. His relationship with Java goes right back to the beginning,
using Java 1.0 for writing desktop applications and applets for interactive web
sites. David has been developing Enterprise Java Applications using both the J2EE
standards and open source solutions for the last five years. David runs the Java
community web site, Develop In Java, a web site for all levels of Java developers.
David co-authored the book Building SOA-Based Composite Applications Using
NetBeans IDE 6.
Mario Pérez Madueño started developing applications for Zeus Sistemas in 1995
using Borland C++ Builder. He graduated in computer science in 2006 and is still
studying to obtain a Master's degree in the EHEA, although what he actually would
like is the Java programming with passion graduate.
Mario also works most recently as software engineer for Altra Software, helping to
develop Java desktop and EE5 applications.
As technical reviewer, Mario also worked for Packt Publishing on the title Building
SOA-Based Composite Applications Using NetBeans IDE 6.
This material is copyright and is licensed for the sole use by Henry Vanyan on 26th July 2009
7406 Valaho Dr, , Tujunga, , 91042
This material is copyright and is licensed for the sole use by Henry Vanyan on 26th July 2009
7406 Valaho Dr, , Tujunga, , 91042
Table of Contents
Preface 1
Chapter 1: Getting Started with NetBeans 7
Introduction 7
Downloading NetBeans 9
Installing NetBeans 12
Microsoft Windows 12
Mac OS X 13
Linux and Solaris 13
Other Platforms 13
Installation Procedure 14
Starting NetBeans for the First Time 19
Configuring NetBeans for Java EE Development 20
Integrating NetBeans with a Third Party Application Server 21
Integrating NetBeans with a Third Party RDBMS 24
Adding a JDBC Driver to NetBeans 24
Connecting to a Third Party RDBMS 26
Deploying Our First Application 28
NetBeans Tips for Effective Development 33
Code Completion 33
Code Templates 37
Keyboard Shortcuts 38
Understanding NetBeans Visual Cues 42
Summary 44
Chapter 2: Developing Web Applications with Servlets
and JSPs 45
Creating Our First Web Application 45
Modifying NetBeans' Generated Code 52
Developing the Input Page 52
Developing the Output Page 61
This material is copyright and is licensed for the sole use by Henry Vanyan on 26th July 2009
7406 Valaho Dr, , Tujunga, , 91042
Table of Contents
Servlet Development 68
Adding a Servlet to Our Application 68
Securing Web Applications 77
Implementing Form Based Authentication 79
Implementing the Login Page 79
Implementing a Login Error Page 81
Configuring Our Application for Form-Based Authentication 82
JSP Fragments 90
Creating a JSP Fragment in NetBeans 91
Monitoring Web Applications with NetBeans HTTP Monitor 93
Summary 100
Chapter 3: Enhancing JSP Functionality with JSTL
and Custom Tags 101
Core JSTL Tags 102
Conditionally Displaying Part of a Page with the <c:if> Tag 102
Displaying Mutually Exclusive Markup with the <c:choose> Tag 105
Iterating through Arrays or Collections with the <c:forEach> Tag 109
SQL JSTL Tags 112
Retrieving Database Data with the <sql:query> Tag 115
Modifying Database Data with the <sql:update> Tag 119
Inserting Database Data 119
Updating Database Data 123
Deleting Database Data 125
Closing Remarks about JSTL 128
Custom JSP Tags 128
Summary 134
Chapter 4: Developing Web Applications using
JavaServer Faces 135
Developing Our first JSF Application 136
Creating a New JSF Project 137
Modifying Our JSP to Capture User Data 141
Creating Our Managed Bean 147
Implementing Navigation 152
Executing Our Application 156
JSF Validation 158
Displaying Tabular Data 162
Summary 171
Chapter 5: Interacting with Databases through
the Java Persistence API 173
Creating Our First JPA Entity 174
Adding Persistent Fields to Our Entity 182
[ ii ]
This material is copyright and is licensed for the sole use by Henry Vanyan on 26th July 2009
7406 Valaho Dr, , Tujunga, , 91042
Table of Contents
This material is copyright and is licensed for the sole use by Henry Vanyan on 26th July 2009
7406 Valaho Dr, , Tujunga, , 91042
Table of Contents
[ iv ]
This material is copyright and is licensed for the sole use by Henry Vanyan on 26th July 2009
7406 Valaho Dr, , Tujunga, , 91042
Preface
In 1999, Sun Microsystems split the Java language into three editions, J2SE
(Java 2, Standard Edition), J2ME (Java 2, Micro Edition), and J2EE (Java 2, Enterprise
Edition). The reason for the split was that the Java language was covering a lot of
territory, and not all developers used all the features of the language. To make the
language more manageable, the decision was made to split the language into the
three editions.
Since then, the different editions of the language have been renamed to Java SE,
Java ME, and Java EE. The reason for renaming the different editions was that the
Java platform obtained brand recognition among consumers, and Sun Microsystems
wanted to make it obvious that Java SE, ME, and EE were recognized as part of the
Java platform.
All three editions share the core of the Java language, but additional APIs are
included in each edition that are not available in the others. In this book we will
cover Java EE, and how to use NetBeans to more effectively write applications
conforming to the Java EE specification.
Chapter 2 covers how NetBeans aids in the development of web applications using
the servlet API and JavaServer Pages.
Chapter 3 shows how NetBeans can help us create maintainable web applications by
taking advantage of JavaServer Pages Standard Tag Library (JSTL), and it also covers
how to write our own custom JSP tags.
This material is copyright and is licensed for the sole use by Henry Vanyan on 26th July 2009
7406 Valaho Dr, , Tujunga, , 91042
Preface
Chapter 4 explains how NetBeans can help us easily develop web applications that
take advantage of the JavaServer Faces framework.
Chapter 6 covers the NetBeans visual web JSF designer, which allows us to visually
build JSF applications by dragging and dropping components into our JSF pages.
Chapter 9 explains how NetBeans can help us easily develop web services based on
the Java API for XML Web Services (JAX-WS) API.
Appendix B covers the NetBeans profiler, explaining how it can be used to analyze
performance issues in our applications.
[]
This material is copyright and is licensed for the sole use by Henry Vanyan on 26th July 2009
7406 Valaho Dr, , Tujunga, , 91042
Preface
Conventions
In this book, you will find a number of styles of text that distinguish between
different kinds of information. Here are some examples of these styles, and an
explanation of their meaning.
Code words in text are shown as follows: "Earlier in this chapter we discussed how
the required attribute for JSF input fields allows us to easily make input
fields mandatory."
A block of code will be set as follows:
<navigation-rule>
<from-view-id>/welcomeJSF.jsp</from-view-id>
<navigation-case>
<from-outcome>submit</from-outcome>
<to-view-id>/confirmation.jsp</to-view-id>
</navigation-case>
</navigation-rule>
When we wish to draw your attention to a particular part of a code block, the
relevant lines or items will be made bold:
<h:inputText id="email" label="Email Address"
required="true" value="#{RegistrationBean.email}">
<f:validator validatorId="emailValidator"/>
</h:inputText>
New terms and important words are introduced in a bold-type font. Words that
you see on the screen, in menus or dialog boxes for example, appear in our text
like this: " At this point JSF navigation "kicks-in", and we are taken to the
Confirmation Page."
[]
This material is copyright and is licensed for the sole use by Henry Vanyan on 26th July 2009
7406 Valaho Dr, , Tujunga, , 91042
Preface
Reader Feedback
Feedback from our readers is always welcome. Let us know what you think about
this book, what you liked or may have disliked. Reader feedback is important for us
to develop titles that you really get the most out of.
If there is a book that you need and would like to see us publish, please
send us a note in the SUGGEST A TITLE form on www.packtpub.com or
email suggest@packtpub.com.
If there is a topic that you have expertise in and you are interested in either writing
or contributing to a book, see our author guide on www.packtpub.com/authors.
Customer Support
Now that you are the proud owner of a Packt book, we have a number of things to
help you to get the most from your purchase.
Errata
Although we have taken every care to ensure the accuracy of our contents, mistakes
do happen. If you find a mistake in one of our books—maybe a mistake in text or
code—we would be grateful if you would report this to us. By doing this you can
save other readers from frustration, and help to improve subsequent versions of
this book. If you find any errata, report them by visiting http://www.packtpub.
com/support, selecting your book, clicking on the let us know link, and entering
the details of your errata. Once your errata are verified, your submission will be
accepted and the errata added to the list of existing errata. The existing errata can be
viewed by selecting your title from http://www.packtpub.com/support.
[]
This material is copyright and is licensed for the sole use by Henry Vanyan on 26th July 2009
7406 Valaho Dr, , Tujunga, , 91042
Preface
Piracy
Piracy of copyright material on the Internet is an ongoing problem across all media.
At Packt, we take the protection of our copyright and licenses very seriously. If
you come across any illegal copies of our works in any form on the Internet, please
provide the location address or website name immediately so we can pursue
a remedy.
We appreciate your help in protecting our authors, and our ability to bring you
valuable content.
Questions
You can contact us at questions@packtpub.com if you are having a problem with
some aspect of the book, and we will do our best to address it.
[]
This material is copyright and is licensed for the sole use by Henry Vanyan on 26th July 2009
7406 Valaho Dr, , Tujunga, , 91042
Random documents with unrelated
content Scribd suggests to you:
open field expect not the stimulus of praise; the soldier sees his foe,
and his British courage rises at each step; but he who, after perhaps a
night-march of great length, has to ascend mountains, or penetrate
dense bush and ravines, filled probably with a daring and intrepid
enemy, as resolute as athletic, ready to murder any one who may fall
into his hands, and when warfare is of the most stealthy and
enterprising kind, appreciates the praise of his commander, because,
when his acts are conspicuously daring, he is conscious he deserves it.
He does his duty; but human nature renders even the soldier’s intrepid
heart sensible of the approbation of his superior, which he is proud to
know may reach the eye of his parents and friends.”
[456] We regret exceedingly that we have been unable to procure an
authentic portrait of Colonel Seton.
[457] This officer met his death by a sad mischance in 1873, at one of
the London Metropolitan Railway Stations.
[458] His bust is on page 583, vol. ii.
[459] Brevet Lieut.-Colonel.
[460] Brevet Lieut.-Colonel, 30th June 1813
[461] Brevet Major, 21st June 1813.
[462] Brevet Lieut.-Colonel. 9th Dec. 1872
S E V E N T Y- F I F T H R E G I M E N T.
1787–1809.
Raising of the Regiment—India—Home—Ceases to be a Highland Regiment.
I.
1793 to 1796.
The Clan Mackenzie—The various Battalions of the 78th—Offers from F. H.
Mackenzie, Esq. of Seaforth, to raise a Regiment for Government—Letter of
service granted to F. H. Mackenzie, Esq., to raise a Regiment of Highlanders,
to be numbered the 78th—The 1st Battalion—List of officers—Inspected and
passed by Sir Hector Munro—Under Lord Moira in Guernsey—The Campaign of
1794–95 in Holland—The Regiment joins the Duke of York on the Waal—
Nimeguen—Disastrous retreat on Deventer—The Regiment returns home—The
Loyalist war in La Vendée—The Quiberon Expedition—Occupation of L’Île-Dieu
—The Regiment returns home—Colonel F. H. Mackenzie’s proposals to raise a
2nd Battalion for the 78th—Letter of Service granted to him for that purpose—
List of Officers—Inspected and passed by Sir Hector Munro—Granted the title
of the Ross-shire Buffs—Ordered to England—Difficulties prior to embarkation
at Portsmouth—The Regiment sails on secret service—Capture of the Cape of
Good Hope—The Regiment goes into quarters at Capetown, until the arrival of
the 1st Battalion.
Notice posted throughout the Counties of Ross and Cromarty and the
Island of Lewis.
Engraved from a photograph of the original poster.
SEAFORTH’S
HIGHLANDERS
To be forthwith raised for the
Defence of His Glorious Majesty King
George the Third, and the Preservation
of our Happy Constitution in Church
and State.
HUZZA!
The martial spirit of the nation was now so thoroughly roused, and
recruits poured in so rapidly, that, on the 10th of July, 1793, only
four months after the granting of the Letter of Service, the regiment
was inspected at Fort George, and passed by Lieut.-General Sir
Hector Munro. Orders were then issued to augment the corps to
1000 rank and file, and 5 companies, including the flank ones, under
the command of Major Alexander Mackenzie, were embarked for
Guernsey. In October of the same year the remaining 5 companies
were ordered to join their comrades.
“This was an excellent body of men, healthy, vigorous, and
efficient; attached and obedient to their officers, temperate and
regular; in short, possessing those principles of integrity and moral
conduct which constitute a valuable soldier. The duty of officers was
easy with such men, who only required to be told what duty was
expected of them. A young officer, endowed with sufficient judgment
to direct them in the field, possessing energy and spirit to ensure the
respect and confidence of soldiers, and prepared on every occasion
to show them the eye of the enemy, need not desire a command
that would sooner and more permanently establish his professional
character, if employed on an active campaign, than that of 1000
such men as composed this regiment.
“Colonel Mackenzie knew his men, and the value which they
attached to a good name, by tarnishing which they would bring
shame on their country and kindred. In case of any misconduct, he
had only to remonstrate, or threaten to transmit to their parents a
report of their misbehaviour. This was, indeed, to them a grievous
punishment, acting like the curse of Kehama, as a perpetual
banishment from a country to which they could not return with a
bad character.”[467]
After being stationed a short time in Guernsey and the Isle of
Wight, the 78th, in September 1794, embarked with the 80th to join
Lord Mulgrave’s force in Walcheren. While detained by contrary
winds in the Downs, fever broke out on board the transports, which
had recently brought back prisoners of war from the West Indies,
and had not been properly purified; thus several men fell victims to
the disease.
The British troops had landed in Holland, on the 5th of March,
1793, and since then the war had been progressing with varying
success. Without, therefore, giving details of their operations during
the first year and a half, we shall merely sketch the position they
occupied when the 78th landed at Flushing.
On the 1st of July, 1794, the allies having decided to abandon the
line of the Scheldt, the Duke of York retired behind the Dyle, and
was there joined by Lord Moira and 8000 men. On the 22nd the
Duke, having separated from the Austrians, established himself at
Rosendaal, and there remained inactive in his camp the whole of
August and the early part of September; but, on the 15th of
September, Boxtel having fallen into the hands of General Pichegru,
he was constrained to break camp and retire across the Meuse, and
finally across the Waal, establishing his head-quarters at Nimeguen.
At this juncture the 78th and 80th reached Flushing, and found
that Lord Mulgrave was ordered home. They therefore embarked
with the 79th, 84th, and 85th, to join the Duke’s army. Early in
October the 78th landed at Tuil, and proceeded to occupy the village
of Rossem in the Bommeler-Waart, or Island of Bommel, where they
first saw the enemy, scarcely one hundred yards distant, on the
opposite side of the river. Here, through the negligence of a Dutch
Emigrant Officer, a sad accident occurred. This person hearing voices
on the bank of the river, and dreading a surprise, ordered his
gunners to fire an iron 12-pounder, loaded with case shot, by which
discharge the officer of the day, Lieut. Archibald Christie, 78th, and a
sergeant, were seriously wounded while visiting a sentry. They both
recovered, but were unable to serve again; strange to say, the
sentry escaped untouched. While quartered here, by a tacit
understanding, the sentries exchanged no shots, but it was observed
that the French frequently fired howitzers with effect when the
troops were under arms, and that, before the fire commenced, the
sails of a certain windmill were invariably put in motion. The owner
was arrested, found guilty as a spy, and condemned to death, but
was reprieved through the lenity of Lieut.-Colonel Mackenzie, the
commandant, with the full understanding that, on a repetition of the
offence, the last penalty would be enforced.
About the end of October the 78th proceeded to Arnheim, the
Duke of York’s headquarters, and thence, by a night march, to
Nimeguen, against which place the French were erecting batteries.
On the 4th of November a sortie was made, when the 78th was for
the first time under fire, and did such execution with the bayonet, as
to call forth the highest encomiums from experienced and veteran
officers. The loss of the regiment in this engagement was Lieutenant
Martin Cameron (died of his wounds) and seven men, killed;
wounded, Major Malcolm, Captain Hugh Munro, Captain Colin
Mackenzie, Lieutenant Bayley, 4 sergeants, and 56 rank and file.
On the 6th the regiment marched from Nimeguen to Arnheim, and
finally to Dodewaart on the Waal, where they were brigaded with
the 12th, the 33rd, under Lieut.-Colonel Arthur Wellesley (afterwards
Duke of Wellington), and the 42nd under Major Dickson. The
General going home on leave, the command devolved on Colonel
Alexander Mackenzie of the 78th, who, however, still remained with
his regiment.
On the 2nd of December the Duke of York quitted Arnheim for
England, and handed over his command to Lieut.-General Harcourt.
On the 29th of December General Daendels, having crossed the
Waal on the ice and driven back the Dutch, Major-General Sir David
Dundas was ordered to dislodge him. He, therefore, marched
towards Thiel by Buren and Geldermalsen, and came up with the
enemy at Tuil, which village he carried at the point of the bayonet
with comparatively little loss, though Brevet Major Murray and three
men of the light company, 78th, were killed by the bursting of a shell
thrown from a distant battery. After the action the troops lay on their
arms in the snow until the evening of the 31st, and the French
recrossed the Waal.
On the 3rd of January 1795 the French repossessed themselves of
Tuil, and on the 5th they drove in the British outposts at Meteren,
capturing two three-pounders, which were, however, recovered later
in the day. They then attacked Geldermalsen. The 78th were in
advance, supported by the 42nd, when they were charged by a
Republican cavalry corps, dressed in the same uniform as the French
Emigrant Regiment of Choiseul. They advanced towards the
Highlanders with loud cries of “Choiseul! Choiseul!” and the 78th,
believing them to be that regiment, forbore to fire upon them until
they were quite close, when, discovering the mistake, they gave
them a warm reception, and those of the enemy who had
penetrated beyond their line were destroyed by the 42nd. The
infantry then came up, the officers shouting “Avançez,
Carmagnoles!” but the 78th, reserving their fire till the foe had
almost closed with them, poured in such a withering volley, that they
were completely demoralised and retreated in great confusion. It
was remarked that in this action the French were all half drunk, and
one officer, who was wounded and taken, was completely tipsy. The
loss of the 78th was four men killed, and Captain Duncan Munro and
seven men wounded. It was on this occasion that a company of the
78th, commanded by Lieutenant Forbes, showed an example of
steadiness that would have done honour to the oldest soldiers,
presenting and recovering arms without firing a shot upon the
cavalry as they were coming down. The whole behaved with great
coolness, and fired nearly 60 rounds per man.
On the night of the 5th the troops retired to Buren. On the 6th the
British and Hanoverians retired across the Leck, with the exception
of the 6th Brigade, Lord Cathcart’s, which remained at Kuilenburg.
On the 8th both parties assumed the offensive, but the British
advance was countermanded on account of the severity of the
weather. It happened, however, luckily for the picquet of the 4th
Brigade, which was at Burenmalsen, opposite to Geldermalsen, that
the order did not reach Lord Cathcart until he had arrived at Buren,
as being driven in, it must otherwise have been taken. Here a long
action took place, which ended in the repulse of the French. The 4th
and a Hessian Brigade went into Buren, and the British into the
castle.
The day the troops remained here, a man in the town was
discovered selling gin to the soldiers at such a low price as must
have caused him an obvious loss, and several of the men being
already drunk, the liquor was seized, and ordered by General
Dundas to be divided among the different corps, to be issued at the
discretion of commanding officers. Thus what the French intended to
be a means of destruction, turned out to be of the greatest comfort
and assistance to the men during their fearful marches through ice
and snow. During the afternoon a man was apprehended at the
outposts, who had been sent to ascertain whether the trick had
taken effect, and whether the troops were sufficiently drunk to be
attacked with success.
Abercromby and Hammerstein having been unable to reach Thiel,
were, with Wurmb’s Hessians, united to Dundas at Buren. On the
10th the French crossed the Waal, and General Regnier crossing the
Oeg, drove the British from Opheusden, back upon Wageningen and
Arnheim, with a loss of fifty killed and wounded. Abercromby,
therefore, withdrew, and the British retired across the Rhine at
Rhenen. This sealed the fate of Holland, and on the 20th General
Pichegru entered Amsterdam.
The inclemency of the season increased, and the rivers, estuaries,
and inundations froze as they had never been known to do before,
so that the whole country, land and water, was one unbroken sheet
of ice.
The Rhine was thus crossed on the ice on the night of the 9th of
February, and for two more nights the 78th lay upon their arms in
the snow, and then marched for Wyk. On the 14th Rhenen was
attacked by the French, who were repulsed by the Guards, with a
loss of 20 men; however, the same night it was determined to
abandon the Rhine, and thus Rhenen, the Grand Hospital of the
army, fell into the hands of the French, who, nevertheless, treated
the sick and wounded with consideration. After resting two hours in
the snow during the night, the 78th resumed their march, passed
through Amersfoort, and about 11 A.M. on the 15th lay down in some
tobacco barns, having marched nearly 40 miles. It had been decided
to occupy the line of the Yssel, and Deventer therefore became the
destination. On the 16th at daybreak the regiment commenced its
march across the horrible waste called the Veluwe. Food was not to
be obtained, the inhabitants were inhospitable; with the enemy in
their rear, the snow knee deep, and blown in swirls by the wind into
their faces, until they were partially or entirely blinded, their plight
was most pitiable.
They had now a new enemy to encounter. Not only was the
weather still most severe, and the Republicans supposed to be in
pursuit, but the British had, in consequence of French emissaries, a
concealed enemy in every Dutch town and village through which
they had to pass. Notwithstanding the severity of the climate,—the
cold being so intense that brandy froze in bottles—the 78th, 79th
(both young soldiers), and the recruits of the 42nd, wore their kilts,
and yet the loss was incomparably less than that sustained by the
other corps.
After halting at Loo to allow the officers and men to take off their
accoutrements, which they had worn day and night since the 26th
December, they on the 18th marched to Hattem on the Yssel. Finally,
on the 28th of March the 78th entered Bremen, and the army being
embarked, the fleet sailed on the 12th of April. On the 9th of May,
1795, the shores of Old England brought tears into the eyes of the
war-worn soldiers, and the first battalion of the Ross-shire Buffs
landed at Harwich, and proceeded to Chelmsford, where they took
over the barracks. After making up the returns, and striking off the
names of all men supposed to be dead or prisoners, the regiment,
which had embarked on the previous September 950 strong, and in
excellent health, was found to be reduced to 600 men, which
number included the disabled and sick who had not been yet
invalided. The 78th remained three weeks at Chelmsford, and
marched to Harwich, where it was brigaded with the 19th, under
command of General Sir Ralph Abercromby. It then proceeded to
Nutshalling (now Nursling) Common, where a force was assembling
under the Earl of Moira, with a view to making a descent on the
French coast.
On the 18th of August the 78th, in company with the 12th, 80th,
and 90th Regiments, and some artillery, embarked under the
command of Major-General W. Ellis Doyle, and sailed for Quiberon
Bay; the design was to assist the French Royalists. They bore down
on Noirmoutier, but finding the island strongly reinforced, and a
landing impracticable, they made for L’Île-Dieu, where they landed
without opposition. Here they remained for some time, enduring the
hardships entailed by continued wet weather and a want of proper
accommodation, coupled with an almost total failure of the
commissariat, but were unable to assist Charette or his royalist
companions in any way. Finally, the expedition embarked in the
middle of December, joined the grand fleet in Quiberon Bay, and
proceeded with it to Spithead.
On the 13th of October 1793, Seaforth made an offer to
Government to raise a second battalion for the 78th Highlanders;
and on the 30th Lord Amherst signed the king’s approval of his
raising 500 additional men on his then existing letter of service.
However, this was not what he wanted; and on the 28th of
December he submitted three proposals for a second battalion to
Government.
On the 7th of February 1794, the Government agreed to one
battalion being raised, with eight battalion and two flank companies,
each company to consist of “one hundred private men,”[468] with the
usual complement of officers and non-commissioned officers. But
Seaforth’s services were ill requited by Government; for while he
contemplated raising a second battalion to his regiment, Lord
Amherst had issued orders that it was to be considered as a
separate corps. The following is a copy of the letter addressed to Mr
Secretary Dundas by Lieut.-Colonel Commandant F. H.
Mackenzie[469]:—
“St Alban’s Street,
“8th Feb. 1794.
“Sir,—I had sincerely hoped I should not be obliged to trouble you
again; but on my going to-day to the War Office about my letter of
service (having yesterday, as I thought, finally agreed with Lord
Amherst), I was, to my amazement, told that Lord Amherst had
ordered that the 1000 men I am to raise were not to be a second
battalion of the 78th, but a separate corps. It will, I am sure, occur
to you that should I undertake such a thing, it would destroy my
influence among the people of my country entirely; and instead of
appearing as a loyal honest chieftain calling out his friends to
support their king and country, I should be gibbeted as a jobber of
the attachment my neighbours bear to me. Recollecting what passed
between you and me, I barely state this circumstance; and I am,
with great respect and attachment, Sir, your most obliged and
obedient servant,
“F. H. Mackenzie.”
II.
1 7 9 6 – 1 8 1 7.
1st and 2d Battalions amalgamated—The Regiment sails for the Cape—The
consolidation completed—Capture of a Dutch fleet—Ordered to India—
Lucknow—Cession of Allahabad—Various changes of Quarters—Colonels
Alexander Mackenzie and J. R. Mackenzie quit the Regiment—Ordered to
Bombay—Join General Wellesley’s Army—The Mahrattas—The Treaty of Bassein
—Lake and Wellesley take the field—War between the British and the
Mahrattas—Ahmednuggur taken—Battle of Assaye—Colours granted to the
74th and 78th—Wellesley’s pursuit of the Enemy—Battle of Argaum—
Gawilghur taken—The Regiment goes to Goojerat—From Bombay to Goa—
Excellent conduct—Ordered to Madras and thence to Java—Landing near
Batavia, which is invested—The Cantonment of Waltevreeden forced—The
Fortification of Cornelis captured, when General Jansens flies—Colonel
Gillespie defeats Jansens—The French army surrender and evacuate the Island
—Rebellion of the Sultan of Djokjokarta—His Capital is taken, and he is
deposed—Colonel Fraser and Captain Macpherson murdered by Banditti at
Probolingo—Major Forbes defeats the Insurgents—Thanks of Government to
the Regiment—Expeditions against the Islands of Bali and Celebes—The
Regiment sails for Calcutta—Six Companies wrecked on the Island of Preparis
—General Orders by the Indian Government—The Regiment lands at
Portsmouth and proceeds to Aberdeen—Unfounded charge against the
Highland Regiments.
On the 28th of November, 1795, the Duke of York had issued orders
for the consolidation of both battalions, and accordingly, on the
arrival of the 1st battalion from L’Île-Dieu, the work was commenced
by the attachment to it of that part of the 2nd battalion which had
been left behind. On the 26th of February, 1796, only seven weeks
after its return from abroad, the battalion proceeded from Poole to
Portsmouth, where it embarked for the Cape in two divisions under
the command of Lieut.-Colonel Alexander Mackenzie of Belmaduthy,
and sailed on the 6th of March. On the 30th of May the 78th arrived
in Simon’s Bay, and on the 1st of June landed and commenced its
march to Capetown. Here the work of consolidation was completed,
and the supernumerary officers and men ordered home. The
regiment now presented the appearance of a splendid body of men,
and mustered 970 Highlanders, 129 Lowlanders, and 14 English and
Irish, the last chiefly bandsmen. The Batavian Republic had formally
declared war against England in May; and, accordingly, on the 3rd of
August, apparently with the view of attempting the recapture of the
Cape, a Dutch fleet under Admiral Lucas anchored in Saldanha Bay.
General Craig, the commander of the troops, marched up a force,
which included the grenadier and light battalions of the 78th. As the
Dutch fleet, however, surrendered, the troops marched back to a
place called Groenekloof, about half-way to Capetown, where they
remained encamped for three or four weeks, when the 78th
marched to Capetown, and occupied the hill near the Castle until the
transports were ready to convey them to India.
On the 4th of November the regiment embarked, and sailed on
the 10th; it had a long passage, during which scurvy made its
appearance, but to no formidable extent. On the 10th of February
1797 the transports reached Calcutta, and the following day the
regiment marched into Fort William. Ten days later it embarked in
boats on the Hoogly, and proceeded to Burhampoor, the voyage
occupying fourteen days. About the 1st of August, on the
embarkation of the 33rd Regiment with the expedition intended
against Manilla, the 78th proceeded to Fort William. In the beginning
of October six companies were again embarked in boats, and
proceeded to Chunar. From Chunar, about the end of November, the
division, having drawn camp equipment from the magazine, was
ordered to drop down to Benares, there to land, and form part of a
large escort to the Governor-General (Sir John Shore), and the
Commander-in-Chief (Sir A. Clarke), about to proceed to Lucknow.
The division accordingly landed at Benares on the 6th of December
and marched to Sheopoor, six miles on the road, where it halted to
complete its field equipment. In the beginning of November, the
33rd having returned to Fort William, the second division of the 78th
embarked and proceeded to Chunar, where it was landed and
encamped until the following March.
On the 9th of December the first division was joined by a part of
the 3rd Native Infantry, some artillery with field-pieces, and two
russallahs or squadrons of Irregular Hindoostani Cavalry, formerly
the body-guard of General De Boigne, a Savoyard in Sindiah’s
service, and marched forward, forming the escort above mentioned.
The march was continued without halting for fifteen days, which
brought the force to the race-course of Lucknow, where it was
joined by the remainder of the 3rd Native Infantry. It is unnecessary
to enter here into the complications of native Indian politics. It is
enough to say that on the death, in 1797, of the troublesome Asoph-
ud-Dowla, the Nawaub Vizir of Oudh, he was succeeded by his
equally troublesome and weak-minded son, Mirza Ali.
The young prince had barely ascended the throne, however, ere
reports were brought to the Governor-General of his incapacity,
faithless character, and prodigality. It was on receiving these reports,
therefore, that Sir John Shore determined to proceed to Lucknow in
person, and, by actual observation, satisfy himself of the merits of
the case. The narrative is resumed from the regimental records of
the 78th.
“On the frontier of the Nawaub Vizir’s dominions, we had been
met by the new Nawaub Vizir, Ali, a young lad of known faithless
principles, with a large force; and his intentions being considered
very suspicious, each battalion furnished a captain’s outlying picquet,
for the security of the camp at night, which was continued until after
his deposition and the elevation of his successor, Saadut Ali, on the
22nd January 1798.”
By skilful management Vizir Ali was secured without violence, and
his uncle, Saadut Ali, placed in his stead.
On the 23rd of February, the 78th, the 1st Battalion Native
Infantry, and a company of Artillery, under the command of Colonel
Mackenzie of the 78th, marched for the Fort of Allahabad, which had
lately been ceded to the British by Saadut Ali.
After various movements, the 78th found itself in garrison at Fort
William in December 1800. In the October of that year Lieut.-Colonel
Alexander Mackenzie had left for England, handing over his
command to Lieut.-Colonel J. Randoll Mackenzie of Suddie.[471] And
in the latter part of November Lieut.-Colonel Mackenzie also went to
England, and was succeeded in the command of the regiment by
Lieut.-Colonel Adams. The regiment remained in quarters at Fort
William during the whole of 1801 and 1802.
In the middle of January, 1803, the 78th received orders to
prepare for embarkation for Bombay, where head-quarters arrived
on the 26th of March, and immediately received orders to prepare
for field service. The regiment re-embarked on the 4th of April, and
proceeded to Bassein, where it landed on the 7th, and marched at
once to join the camp of Colonel Murray’s detachment at Sachpara,
7 miles from the town; being formed as an escort to His Highness
the Peshwah, who had been driven from his dominions by Holkar
during the previous October.
The detachment set out on the 18th of April, and marched by
Panwell and the Bhore Ghât. In the beginning of June the 78th
joined at Poonah the army under General Wellesley, destined to act
against Sindiah and the Mahrattas. The regiment was posted to the
brigade commanded by Lieut.-Colonel Harness, 80th Regiment,
which was called the 4th brigade, with reference to the Grand
Madras Army, from which General Wellesley was detached, but
which formed the right of the General’s force. Its post in line was the
right of the centre, which was occupied by the park, and on the left
of the park was the 74th Highlanders, in the brigade commanded by
Colonel Wallace, 74th, and called the 5th Brigade. Besides these two
brigades of infantry there was one of cavalry, commanded by Lieut.-
Colonel Maxwell, 19th Light Dragoons; each brigade consisted of 1
European and 3 native regiments. The train consisted of four iron
and four brass 12-pounders, besides two 5½-inch howitzers, and
some spare field-pieces.
A very few days after the army moved forward the rainy season
commenced, but was by no means a severe one; the great want of
forage, however, at the commencement of this campaign, destroyed
much cattle, and the 78th Highlanders, who were by no means so
well equipped as the other corps, were a good deal distressed at
first. The movements of the army were slow, making long halts, and
not keeping in a straight direction till the beginning of August, when
it encamped about 8 miles south of Ahmednuggur, in which position
it was when negotiations were broken off and war declared with
Dowlut Rao Sindiah and the Rajah of Berar, Ragojee Bhoonslah.
On the 8th of August the advanced guard was reinforced by the
flank companies of the 74th and 78th Highlanders, and the city of
Ahmednuggur was attacked and carried by storm in three columns,
of which the advanced guard formed one, the other two being led by
battalion companies of the same regiments. “The fort of
Ahmednuggur is one of the strongest in India, built of stone and a
Welcome to our website – the ideal destination for book lovers and
knowledge seekers. With a mission to inspire endlessly, we offer a
vast collection of books, ranging from classic literary works to
specialized publications, self-development books, and children's
literature. Each book is a new journey of discovery, expanding
knowledge and enriching the soul of the reade
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.
ebookultra.com