You are on page 1of 53

Java EE Development with Eclipse -

Second Edition Ram Kulkarni


Visit to download the full and correct content document:
https://textbookfull.com/product/java-ee-development-with-eclipse-second-edition-ram
-kulkarni/
More products digital (pdf, epub, mobi) instant
download maybe you interests ...

Java EE Development with Eclipse 1st Edition Vohra


Deepak

https://textbookfull.com/product/java-ee-development-with-
eclipse-1st-edition-vohra-deepak/

Java EE 7 Development with NetBeans 8 1st Edition


Heffelfinger David R

https://textbookfull.com/product/java-ee-7-development-with-
netbeans-8-1st-edition-heffelfinger-david-r/

Java EE 7 Development with WildFly 1st Edition Cmil


Michal Matloka Michal Marchioni Francesco

https://textbookfull.com/product/java-ee-7-development-with-
wildfly-1st-edition-cmil-michal-matloka-michal-marchioni-
francesco/

Building RESTful Web Services with Java EE 8 Create


modern RESTful web services with the Java EE 8 API
Mario-Leander Reimer

https://textbookfull.com/product/building-restful-web-services-
with-java-ee-8-create-modern-restful-web-services-with-the-java-
ee-8-api-mario-leander-reimer/
Java EE 6 Pocket Guide A Quick Reference for Simplified
Enterprise Java Development 1st Edition Gupta Arun

https://textbookfull.com/product/java-ee-6-pocket-guide-a-quick-
reference-for-simplified-enterprise-java-development-1st-edition-
gupta-arun/

Java EE 6 with GlassFish 3 Application Server 1st


Edition Heffelfinger David

https://textbookfull.com/product/java-ee-6-with-
glassfish-3-application-server-1st-edition-heffelfinger-david/

Practical Domain-Driven Design in Enterprise Java -


Using Jakarta EE, Eclipse MicroProfile, Spring Boot,
and the Axon Framework 1st Edition Vijay Nair

https://textbookfull.com/product/practical-domain-driven-design-
in-enterprise-java-using-jakarta-ee-eclipse-microprofile-spring-
boot-and-the-axon-framework-1st-edition-vijay-nair/

Beginning EJB in Java EE 8: Building Applications with


Enterprise JavaBeans Jonathan Wetherbee

https://textbookfull.com/product/beginning-ejb-in-java-
ee-8-building-applications-with-enterprise-javabeans-jonathan-
wetherbee/

Introducing Jakarta EE CDI Contexts and Dependency


Injection for Enterprise Java Development 1st Edition
Luqman Saeed

https://textbookfull.com/product/introducing-jakarta-ee-cdi-
contexts-and-dependency-injection-for-enterprise-java-
development-1st-edition-luqman-saeed/
Table of Contents
Java EE Development with Eclipse Second Edition
Credits
About the Author
About the Reviewers
www.PacktPub.com
Support files, eBooks, discount offers, and more
Why subscribe?
Free access for Packt account holders
Preface
What this book covers
What you need for this book
Who this book is for
Conventions
Reader feedback
Customer support
Downloading the example code
Errata
Piracy
Questions
1. Introducing JEE and Eclipse
Java Enterprise Edition (JEE)
The presentation layer
Java Servlet
Java Server Pages
Java Server Faces
The business layer
Enterprise Java Beans
The enterprise integration layer
Java Database Connectivity (JDBC)
The Java Persistent API (JPA)
Java Connector Architecture (JCA)
Web services
Eclipse IDE
Workspace
Plugin
Editors and views
Perspective
Eclipse preferences
Installing products
Installing Eclipse (Version 4.4)
Installing Tomcat
Installing the GlassFish server
Installing MySQL
Installing MySQL on Windows
Installing MySQL on Mac OS X
Installing MySQL on Linux
Creating MySQL users
Summary
2. Creating a Simple JEE Web Application
Configuring Tomcat in Eclipse
Java Server Pages
Creating a dynamic web project
Creating JSP
Running JSP in Tomcat
Using JavaBeans in JSP
Using JSTL
Implementing login application using Java Servlet
Creating WAR
Java Server Faces
Using Maven for project management
Maven views and preferences in Eclipse JEE
Creating a Maven project
Maven Archetype
Exploring the POM
Adding Maven dependencies
The Maven project structure
Creating WAR using Maven
Summary
3. Source Control Management in Eclipse
The Eclipse Subversion plugin
Installing the Eclipse Subversion plugin
Adding a project to an SVN repository
Committing changes to an SVN repository
Synchronizing with an SVN repository
Checking out a project from SVN
The Eclipse Git plugin
Adding a project to Git
Committing files in a Git repository
Viewing a file difference after modifications
Creating a new branch
Committing a project to a remote repository
Pulling changes from a remote repository
Cloning a remote repository
Summary
4. Creating a JEE Database Application
Creating a database schema
The script for creating tables and relationships
Creating tables in MySQL
Creating a database application using JDBC
Creating a project and setting up Maven dependencies
Creating JavaBeans for data storage
Creating JSP to add a course
JDBC concepts
Creating a database connection
Executing SQL statements
Handling transactions
Using the JDBC database connection pool
Saving a course in a database table using JDBC
Getting courses from the database table using JDBC
Completing the add Course functionality
Using Eclipse Data Source Explorer
Creating a database application using JPA
Creating the user interface for adding a course using JSF
JPA concepts
Entity
EntityManager
EntityManagerFactory
Creating a JPA application
Creating a new MySQL schema
Setting up a Maven dependency for JPA
Converting a project into a JPA project
Creating entities
Configuring entity relationships
Configuring a many-to-one relationship
Configuring a many-to-many relationship
Creating database tables from entities
Using JPA APIs to manage data
Wiring the user interface with a JPA service class
Summary
5. Unit Testing
JUnit
Creating and executing unit tests using Eclipse EE
Creating a unit test case
Running a unit test case
Running a unit test case using Maven
Mocking external dependencies for unit tests
Using Mockito
Calculating test coverage
Summary
6. Debugging a JEE Application
Debugging a remote Java application
Debugging a web application using Tomcat in Eclipse EE
Starting Tomcat in debug mode
Setting breakpoints
Running an application in debug mode
Performing step operations and inspecting variables
Inspecting variable values
Debugging an application in an externally configured Tomcat
Using Debugger to know the status of a program execution
Summary
7. Creating JEE Applications with EJB
Types of EJB
Session bean
Stateful session bean
Stateless session bean
Singleton session bean
Accessing session bean from the client
Creating a no-interface session
Accessing session bean using dependency injection
Creating session bean using the local business interface
Accessing session bean using the JNDI lookup
Creating session bean using a remote business interface
Accessing a remote session bean
Configuring the GlassFish server in Eclipse
Creating the CourseManagement application using EJB
Creating an EJB project in Eclipse
Configuring datasource in GlassFish 4
Configuring JPA
Creating a JPA entity
Creating stateless EJB
Creating JSF and managed bean
Running the example
Creating EAR for deployment outside Eclipse
Creating a JEE project using Maven
Summary
8. Creating Web Applications with Spring MVC
Dependency injection
Dependency injection in Spring
Component scopes
Installing the Spring Tool Suite
Creating a Spring MVC application
Creating a Spring project
Understanding files created by the Spring MVC project
template
Spring MVC application using JDBC
Configuring datasource
Using the Spring JDBCTemplate class
Creating the Spring MVC Controller
Calling Spring MVC Controller
Mapping data using @ModelAttribute
Using parameters in @RequestMapping
Using the Spring interceptor
Spring MVC application using JPA
Configuring JPA
Creating the Course entity
Creating Course DAO and Controller
Creating the Course list view
Summary
9. Creating Web Services
JAXB
JAXB example
REST web services
Creating RESTful web services using Jersey
Implementing the REST GET request
Testing the REST GET request in browser
Creating a Java client for the REST GET web service
Implementing the REST POST request
Writing a Java client for the REST POST web service
Invoking the POST REST web service from JavaScript
Creating the REST web service with Form POST
Creating a Java client for the form-encoded REST web service
SOAP web services
SOAP
WSDL
UDDI
Developing web services in Java
Creating a web service implementation class
Using the JAX-WS reference implementation (GlassFish
Metro)
Inspecting WSDL
Implementing a web service using an interface
Consuming a web service using JAX-WS
Specifying an argument name in a web service operation
Inspecting SOAP messages
Handling interfaces in an RPC-style web service
Handling exceptions
Summary
10. Asynchronous Programming with JMS
Steps to send and receive messages using JMS
Creating queues and topics in GlassFish
Creating a JEE project for a JMS application
Creating a JMS application using JSP and JSP bean
Executing addCourse.jsp
Implementing a JMS queue sender class
Implementing a JMS queue receiver class
Adding multiple queue listeners
Implementing the JMS topic publisher
Implementing the JMS topic subscriber
Creating a JMS application using JSF and managed beans
Consuming JMS messages using MDB
Summary
11. Java CPU Profiling and Memory Tracking
Creating a sample Java project for profiling
Profiling a Java application
Identifying resource contention
Memory tracking
Eclipse plugins for profiling memory
Summary
Index
Java EE Development with
Eclipse Second Edition
Java EE Development with
Eclipse Second Edition
Copyright © 2015 Packt Publishing

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, nor Packt Publishing, and its dealers and
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 of the companies and products mentioned in this book by
the appropriate use of capitals. However, Packt Publishing cannot
guarantee the accuracy of this information.

First published: December 2012

Second edition: September 2015

Production reference: 1240915

Published by Packt Publishing Ltd.

Livery Place

35 Livery Street

Birmingham B3 2PB, UK.


ISBN 978-1-78528-534-9

www.packtpub.com
Credits
Author

Ram Kulkarni

Reviewers

Aristides Villarreal Bravo

Jeff Maury

Phil Wilkins

Commissioning Editor

Neil Alexander

Acquisition Editor

Kevin Colaco

Content Development Editor

Nikhil Potdukhe

Technical Editor

Tanmayee Patil

Copy Editors

Tani Kothari

Kausambhi Majumdar

Alpha Singh
Project Coordinator

Izzat Contractor

Proofreader

Safis Editing

Indexer

Tejal Soni

Production Coordinator

Manu Joseph

Cover Work

Manu Joseph
About the Author
Ram Kulkarni has more than two decades of experience in
developing software. He has architected and developed many
enterprise web applications, client-server and desktop applications,
application servers, IDE, and mobile applications. Also, he is the
author of Eclipse 4 RCP Development How-to published by Packt
Publishing. He blogs at ramkulkarni.com.

I would like to thank Kevin Colaco and Nikhil Potdukhe of Packt


Publishing for giving me the opportunity to write this book and
helping me decide the content and format.

Writing this book has been a long process, and it would not have
been possible without the support and patience of my family.

I would like to thank my parents, my wife, Vandana, and son,


Akash, for their continuous love and support. This book is
dedicated to Vandana and Akash.
About the Reviewers
Aristides Villarreal Bravo is a Java developer and a member of
the NetBeans Dream Team and Java User Groups leaders. He lives in
Panamá.

He has organized and participated in various national as well as


international conferences and seminars related to Java, JavaEE,
NetBeans, NetBeans Platform, free software, and mobile devices. He
has been a writer of tutorials and blogs on Java, NetBeans, and web
developers.

He has participated in several interviews on sites such as NetBeans,


NetBeans DZone, and javaHispano. Also, he has been a developer of
plugins for NetBeans. He has written technical reviews of many
books on PrimeFaces, that includes Primefaces BluePrints, Packt
Publising.

He is also the CEO of Javscaz Software Developers.

I would like to dedicate this to Oris in the sky.

Jeff Maury is currently working as the technical lead of the Java


team at SysperTec Communication, a French ISV that offers
mainframe integration tools.

Prior to SysperTec Communication, in 1996, he was a cofounder of a


French ISV called SCORT, a precursor to the application server
concept that offered J2EE-based integration tools.

He started his career in 1988 at Marben Products, a French


integration company that specialized in telecommunication protocols.
At Marben Products, he started as a software developer and left as
an X.400 team technical lead and Internet division strategist.
I would like to dedicate my work to Jean-Pierre ANSART, my
mentor, and thank my wife, Julia, for her patience, and my three
sons, Robinson, Paul, and Ugo.

Phil Wilkins has spent over 25 years in the software industry


working for both multinationals and software startups. He started
out as a developer and worked his way up through technical and
developmental leadership roles, primarily in Java-based
environments. Currently, he is working as an enterprise technical
architect in the IT group of a global optical healthcare manufacturer
and retailer using Oracle middleware, cloud, and Red Hat JBoss
technologies.

Outside his work commitments, he has contributed his technical


capabilities to supporting others in a wide range of activities that
include developing community websites, providing input and support
to people authoring books, developing software ideas and
businesses, and reviewing a range of technical books for Packt and
other publishers. Also, he is a blogger and a participant in the Oracle
middleware community.

When not immersed in work and technology, he spends his


downtime pursuing his passion for music and with his wife and two
boys.

I'd like to take this opportunity to thank my wife, Catherine, and


our two sons, Christopher and Aaron, for their tolerance for the
innumerable hours that I've spent in front of a computer
contributing to activities for both my employer and other IT-
related activities that I've supported over the years.
www.PacktPub.com
Support files, eBooks,
discount offers, and more
For support files and downloads related to your book, please visit
www.PacktPub.com.

Did you know that Packt offers eBook versions of every book
published, with PDF and ePub files available? You can upgrade to the
eBook version at www.PacktPub.com and as a print book customer,
you are entitled to a discount on the eBook copy. Get in touch with
us at <service@packtpub.com> for more details.

At www.PacktPub.com, you can also read a collection of free


technical articles, sign up for a range of free newsletters and receive
exclusive discounts and offers on Packt books and eBooks.

https://www2.packtpub.com/books/subscription/packtlib

Do you need instant solutions to your IT questions? PacktLib is


Packt's online digital book library. Here, you can search, access, and
read Packt's entire library of books.

Why subscribe?
Fully searchable across every book published by Packt
Copy and paste, print, and bookmark content
On demand and accessible via a web browser
Free access for Packt account
holders
If you have an account with Packt at www.PacktPub.com, you can
use this to access PacktLib today and view 9 entirely free books.
Simply use your login credentials for immediate access.
Preface
Java 2 Enterprise Edition (J2EE) has been used to develop enterprise
applications for many years. It provides a standard technique to
implement the many aspects of an enterprise application, such as
handling web requests, accessing database, connecting to other
enterprise systems, and implementing web services. Over the years,
it has evolved and made enterprise application development easier
than before. Its name has changed as well, from J2EE to JEE, after
the J2EE version 1.4. Currently, it is in version 7.

Eclipse is a popular Integrated Development Environment (IDE) for


developing Java applications. It has a version specific to the JEE
development too, which makes it faster to write code and easier to
deploy JEE applications on a server. It provides excellent debugging
and unit testing support. Eclipse has a modular architecture, and
many plugins are available today to extend its functionality for
performing many different tasks.

This book provides you with all the information that you will need to
use Eclipse to develop, deploy, debug, and test JEE applications. The
focus of this book is to provide you with practical examples of how
to develop applications using JEE and Eclipse. The scope of this book
is not limited to JEE technologies, but covers other technologies
used in the different phases of application development as well, such
as source control, unit testing, and profiling.

JEE is a collection of many technologies and specifications. Some of


the technologies are so vast that separate books will have to be
written on them and many have been already written. This book
takes the approach of providing you with a brief introduction to each
technology in JEE and provides links for detailed information. Then it
moves on to develop sample applications using specific technologies
under discussion and explains the finer aspects of the technologies
in the context of the sample applications.
This book could be useful to you if you are new to JEE and want to
get started with developing JEE applications quickly. You will also
find this book useful if you are familiar with JEE but looking for
hands-on approach to use some of the technologies in JEE.
What this book covers
Chapter 1, Introducing JEE and Eclipse, explains in brief the different
technologies in JEE and where they fit in a typical multitier JEE
application. This chapter describes installing Eclipse JEE, Tomcat,
GlassFish, and MySQL, which are used to develop sample
applications in the later chapters.

Chapter 2, Creating a Simple JEE Web Application, describes the


development of web applications using JSP, Servlet, JSTL, and JSF. It
also explains how to use Maven for project management.

Chapter 3, Source Control Management in Eclipse, explains how to


use the SVN and Git plugins of Eclipse for source code management.

Chapter 4, Creating a JEE Database Application, explains the


creation of database applications using JDBC and JPA. You will learn
how to execute SQL statements directly using JDBC, map Java
classes to database tables, and set relationships between classes
using the JPA and database connection pool.

Chapter 5, Unit Testing, describes how to write and run unit tests for
Java applications, mock external dependencies in unit tests, and
calculate the code coverage.

Chapter 6, Debugging a JEE Application, shows the techniques used


to debug JEE applications and covers the debugging support of
Eclipse.

Chapter 7, Creating JEE Applications with EJB, describes the use of


EJBs to code business logic in the JEE applications. Also, it explains
how to connect to remote EJBs using JNDI and inject EJBs into
container-managed beans.

Chapter 8, Creating Web Applications with Spring MVC, describes the


creation of web applications using Spring MVC and how some of the
JEE technologies can be used in a Spring MVC application.

Chapter 9, Creating Web Services, explains the creation of SOAP-


based and RESTful web services in JEE applications. You will learn
how to consume these web services from JEE applications as well.

Chapter 10, Asynchronous Programming with JMS, shows explains


how to write applications to process messages asynchronously. It
describes how to program queues and topics of messaging systems
using JMS and MDBs.

Chapter 11, Java CPU Profiling and Memory Tracking, describes the
techniques for profiling CPU and memory in Java applications to find
performance bottlenecks.
What you need for this book
You will need JDK 1.7 or later, Eclipse JEE 4.4 or later, Tomcat 7 or
later, GlassFish Server 4 or later, and MySQL Community Server 5.6
or later.
Who this book is for
If you are a Java developer who has little or no experience in JEE
application development, or you have an experience in JEE
technology but are looking for tips to simplify and accelerate your
development process, then this book is for you.
Conventions
In this book, you will find a number of text styles that distinguish
between different kinds of information. Here are some examples of
these styles and an explanation of their meaning.

Code words in text, database table names, folder names, filenames,


file extensions, pathnames, dummy URLs, user input, and Twitter
handles are shown as follows: "We can include other contexts
through the use of the include directive."

A block of code is set as follows:

<body>
<h2>Login:</h2>
<form method="post">
User Name: <input type="text" name="userName">
<br>
Password: <input type="password"
name="password"><br>
<button type="submit"
name="submit">Submit</button>
<button type="reset">Reset</button>
</form>
</body>

When we wish to draw your attention to a particular part of a code


block, the relevant lines or items are set in bold:

try {
Thread.sleep(5000);
} catch (InterruptedException e) {}

Any command-line input or output is written as follows:

>catalina.bat jpda start


New terms and important words are shown in bold. Words that
you see on the screen, for example, in menus or dialog boxes,
appear in the text like this: "To set a breakpoint for an exception,
select Run | Java Breakpoint Exception and select the Exception
class from the list."

Note
Warnings or important notes appear in a box like this.

Tip
Tips and tricks appear like this.
Reader feedback
Feedback from our readers is always welcome. Let us know what
you think about this book—what you liked or disliked. Reader
feedback is important for us as it helps us develop titles that you will
really get the most out of.

To send us general feedback, simply e-mail


<feedback@packtpub.com>, and mention the book's title in the subject
of your message.

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 at
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.

Downloading the example code


You can download the example code files from your account at
http://www.packtpub.com for all the Packt Publishing books you
have purchased. If you purchased this book elsewhere, you can visit
http://www.packtpub.com/support and register to have the files e-
mailed directly to you.

Errata
Although we have taken every care to ensure the accuracy of our
content, mistakes do happen. If you find a mistake in one of our
books—maybe a mistake in the text or the code—we would be
grateful if you could report this to us. By doing so, you can save
other readers from frustration and help us improve subsequent
versions of this book. If you find any errata, please report them by
visiting http://www.packtpub.com/submit-errata, selecting your
book, clicking on the Errata Submission Form link, and entering
the details of your errata. Once your errata are verified, your
submission will be accepted and the errata will be uploaded to our
website or added to any list of existing errata under the Errata
section of that title.

To view the previously submitted errata, go to


https://www.packtpub.com/books/content/support and enter the
name of the book in the search field. The required information will
appear under the Errata section.
Piracy
Piracy of copyrighted 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 us with the
location address or website name immediately so that we can
pursue a remedy.

Please contact us at <copyright@packtpub.com> with a link to the


suspected pirated material.

We appreciate your help in protecting our authors and our ability to


bring you valuable content.

Questions
If you have a problem with any aspect of this book, you can contact
us at <questions@packtpub.com>, and we will do our best to address
the problem.
Another random document with
no related content on Scribd:
— Salon poikain, salon poikain.
— Keiden kanssa?
- Salon tyttöin, salon tyttöin.
— Älä narraa!
— Narri itse, narri itse.

Näin ne käet kukkuvat. Vaan mitäpä yksin käen kukunnoista.


Tiedättehän tytöt, että salon pojat teistä pitävät, teitä rakastavat. He
teitä omikseen odottavat kuin odottaa maamies hyvää viljavuotta,
lapset mansikkasuvea, taikka nuoruus kevään tuloa, elämä
henkeänsä.

ENSIMÄINEN TYTTÖ:

Meitä pilkkaamaanko olette tulleet?

Salon lapsia. 2

ENSIMÄINEN POIKA:

Kuinka voitte tuommoista ajatellakaan! Kauvan, kauvan on


salonpoikain silmä tänne tähdännyt, sydän täällä asunut. Vaan he
eivät ole uskaltaneet, he ovat vaan loitolta katselleet kuin kukkaa
vinhan virran tuolla puolen. Vaan nyt he vihdoinkin ovat käen neuvon
mieleensä panneet ja tulleet varmuutta saamaan. (Laulavat):

Laulu u;o 9 sävel u:o 10.

Kunnahalla, kukkulalla
Ompi meidän majamme;
Tulkaa, tulkaa tyttö armaat
Jakamaan se kanssamme.
Iloks’ tulkaa äityellen,
Meille päivän paisteheks’;
Tulen tuojaks’ tupasehen
Valkeaisen vaalijaksi.

Korkea ei kotisemme,
Suuri myös ei sukumme,
Honkaseinä pirttisemme
Tehty järven rannalle.

Pirtin päässä petäjikkö,


Tuomi tuvan takana,
Pihamaalla pihlajikko,
Kankahalla kanerva.

TYTÖT (laulavat).

Laulu n:o 10, sävel u:o 11.

Ei ne vielä miehelähän
Nämä tytöt jouda,
Pitkät päivät miehelässä,
Pirtin nurkass’ routa.

Routa pirtin nurkkasessa,


Apen mieless’ halla,
Jospa sinne menisimme
Hupsut oltais vallan.

ENSIMÄINEN POIKA:
Jo nyt laskette leikkiä. Ette ole kuulleet kaikkea, mitä käki on
kukkunut.

ENSIMÄINEN TYTTÖ:

Ne teidän käet, hahhaa! No mitä ne vielä ovat olleet kukkuvinaan?

ENSIMÄINEN POIKA:

Näin ne kukkuvat:

— Yksin yksin
— Mitä yksin?
— Yksin neito kotonansa, kuni kulopetäjä palolla.
— Kaksin kaksin.
— Mitä kaksin?
— Kaksin kaunis olla, kaksin lintusten metsässä.

ENSIMÄINEN TYTTÖ:

Äläppäs! Olen minäkin käkiä kuullut ja niitä on tavallisesti kaksi ja


se toinen aina lisää jotakin jatkoksi. Kuules, näin ne kukkuvat:

— Ensimäinen käki: kaksin kaksin kaunis olla


— Toinen käki: Kun saa toistaan höyhennellä.

ENSIMÄINEN POIKA:

Joutavia! — Kaksin huuletkin kaunihimmat.

ENSIMÄINEN TYTTÖ:
Kun ovat eri paria.

ENSIMÄINEN POIKA:

Kaksin silmätkin somemmat.

ENSIMÄINEN TYTTÖ:

Päässä kierosilmäisen.

ENSIMÄINEN POIKA:

Kaksin aidanseipähätkin.

ENSIMÄINEN TYTTÖ:

Kumpikin omaan puoleensa punnistavi, sidevitsat katkaisevi.

ENSIMÄINEN POIKA:

Kutti, jo puhuit itsesi pussiin! Jos niin olisi, eipä sitte aidat pystyssä
pysyisi ja kun kaatuisi, niin kaatuisi kahtaanne päin. Vaan kuuleppas
sinä sanasutkija: sinunpa kanssasi minä haluaisin tulla saman
sidevitsan liittämäksi. Usko pois, en minä aivan pahoin puoleeni
punnistaisi.

ENSIMÄINEN TYTTÖ:

Vai et punnistaisi! Kyllä teidät tunnetaan: mesi kielellä kosijan.


Haluatko kuulla mitä tämä tyttö ajattelee? Näin (laulaa):

Laula u:o 11, sävel n:o 12,


Valkea ompi kesäpäivä,
Kesäpäivä, kevätpäivä,
Valkea ompi kesäpäivä
Frallala, lallallaa.
Kotona neito valkeampi,
Neitosen valta valkeampi
Emon armaan kodissa.

Kotona neito mansikkana,


Mansikkana, vaapukkana,
Kotona neito mansikkana
Frallala, lallallaa.
Pitempi paljon piha ompi,
Kynnyskin hirttä korkeampi
Miniänä miehelässä.

Nyt sen kuulit!

ENSIMÄINEN POIKA:

Kuulin kyllä, vaan sanotaan että lintu joskus laulaa kielensä


kerkeyttä, ei aina sydämensä syvyyttä.

TOINEN POIKA:

Ja mitä sanoo minun tyttöni?

TOINEN TYTTÖ:

Mitäpä minä sanoisin! Minähän olen niin nuori, tämmöinen tyttö


hupakko.
(Laulaa):
Laulu n:o 12, sävel 13, 14 ja 15.

(Sävel n:o 13.)


Oon kuin kasvava kataja
Tahi tuore tuomen latva;
(Sävel n:o 14.)
Isä kutsuu kuutamoksi,
Äiti päivän paisteheksi.
Puol’ on päätä palmikolla,
Puoli palmikoitsematta;
(Sävel n:o 15.)
Viel' on marjat poimimatta,
Kesken leikit leikkimättä;
Viel’ en jouda vierahalle
Tasaisesta taattolasta.

ENSIMÄINEN POIKA:

Taisimmepa saada rukkaset.

TOINEN POIKA:

Siltä kuulostaa.

ENSIMÄINEN POIKA:

Vaan minkäs sille; jätetään sikseen se asia. — Äiti käski


kertomaan teille paljo terveisiä ja sanomaan ettei tie salotorppaan
käy minkään ylipääsemättömän vuoren poikki.

ENSIMÄINEN TYTTÖ:
Kiitoksia, kiitoksia! Mitenkä jaksaa äitivanhuksenne? Emme ole
moniin aikoihin hänestä mitään kuulleet. Olen aivan utelias.

ENSIMÄINEN POIKA:

Kiitos kysymästä. Eipä niistä äidin jaksamisista kehuen ole, niin on


vointi kuin sammuva illanrusko tahi kuloheinän kuiva latva. Yksin on
äitiparka, aivan liiaks askaretta vanhuksella.

ENSIMÄINEN TYTTÖ:

Sen arvaa sanomatta. Meidän talossa on kolme naista, eikä


kukaan joutilaaksi jouda. Voi kuinka minun tekisi mieleni auttaa
äitiänne. Teidän äitinnehän on niin hyvä, aivan kuin meidän oma
äitimme.

TOINEN TYTTÖ:

Samoin minä niin kovin mielelläni auttaisin. Kantaisin vettä tahi


puita juoksuttaisin, ellen muuhun kykenisi.

POJAT:

Oikeinko totta?

TYTÖT:

Tietysti.

ENSIMÄINEN TYTTÖ:

Kuinka voitte epäilläkään?


ENSIMÄINEN POIKA:

No hei, sitte on kaikki hyvin! Sitähän me juuri äsken tarkoitimme:


avustajiksi äitivanhuksellehan me teitä pyysimme. Ja te tulette niin
mielellänne, niinkuin sanat kuuluivat — — —

TYTÖT:

Ei, ei! Nyt aijotte pettää meidät salakavalasti. Emme me sitä


tarkoittaneet; emme jouda kuin viikoksi, pariksi.

ENSIMÄINEN POIKA:

Eivätkö jouda ainaiseksi, äiti?

EMÄNTÄ (Nauraen):

Joutavat kujeilemasta.

ISÄNTÄ:

Samaa sanon minä.

TYTÖT:

Ei, ei; tämähän on petosta…

ENSIMÄINEN POIKA:

Eikös mitä, elkäähän nyt suotta kaarrelko selvässä asiassa.


Vanhempainne puolesta joudatte ja itse lähdette niin mielellänne
äitiämme auttamaan. Tässä käsi, vankka niinkuin tammi, vaikka vielä
hieman heiveröinen.
ENSIMÄINEN TYTTÖ:

(Vetää molemmat kätensä selän taakse.) Näen että se on siinä,


vaan minäpä jo äsken lauloin.

ENSIMÄINEN POIKA:

Niin lauloit, vaan — tässä se nyt on (saa salaa käden omaansa) ja


pysyy.

ENSIMÄINEN TYTTÖ:

(On riuhtovinaan irti.) Minkäs minä mahdan, en saa irti. — Vaan


viekkaudellapa otit!

ENSIMÄINEN POIKA:

Mitäs joutavista kiistelemme. — — —

TOINEN POIKA:

Ja me kai nyt minun tyttöni kanssa poimimme yhdessä ne marjat,


jotka vielä ovat poimimatta? Pian ne silloin ropehet täyttyy. (Tarttuu
käteen). Eikö niin?

TOINEN TYTTÖ:

(Puoli-itkussa.) Niin, mihinkäs minä tänne yksin jään, kun siskokin


menee. (Iloisemmasti.) Vaan se on siskon syy, sen minä sanon.

MUMMO:
Sepä kovin hauska päätös tälle tarinalle. Arvasinkin, arvasinkin…

KAIKKI (Laulavat, nuoret käsikkäin):

Laulu tuo 13, sävel n:o 16.

Kevään henki luonnoss’ humajaa,


Nyt joka lehti liikkuu,
Kukat keinuu, kiikkuu,
Metsän jättikannel kumajaa
Ja linnut livertävät la-la-la-la-la-laa.
Niinpä salon lasten mieli sykähtää,
Silmä silmään uppoo,
Yhteen yhtyy
Ja käsikkäin
He nyt laulaa näin:
La-la-la-la-la-la-Ia-la-la-la-la-laa
Luonnon jättikannel kumajaa
Ja salon lapset laulaa la-la-la-la-la-laa.

Onnen pilviä taivas nostattaa,


Nyt joka hattar leijaa,
Lemmen hohdett’ heijaa,
Toivon sinikaaria kasvattaa
Ja nuoret laulelevat la-la-la-la-la-Iaa.
Metsän peikot mustat kauvas kaikkoaa,
Meidän liitto nuori
Niinkuin vuori
Ja vierekkäin
Me astumme näin:
La-la-la-la-la-la-la-la-la-la-la-laa
Toivon kaaria taivas kasvattaa,
Ja salon lapset laulaa la-la-la-Ia-la-laa.

(Ulkoa kuuluu laulua).

EMÄNTÄ:

Mikä laulu se ulkona?

MUMMO:

Lapset kai ne lie, jotka palaavat juhannusseppeleitä sitelemästä.


Taisivat joutua seppeleet parempiin tarkoituksiin.

LAPSET (Tulevat seppeleitä päässään, kaulaessaan ja


käsivarsillaan.
Laulavat):

Laulu n:o 14, sävel n:o 17.

Nyt kesäkulta vallitsee


Ja nurmet vihannoivat,
Nyt linnut puissa laulelee
Ja paimenpillit soivat,
Nyt tuoksuavat kukkaset
Jo kankahilla, soilla,
Ja posket ompi punaiset
Nyt mäen mansikoilla.

Nyt kaikki uudet kasvot saa,


Myös pienet lapsukaiset
Nyt ruusupäisnä ruskottaa
Kuin maalla mansikaiset.
Kuin hauska silloin lapsien
On kankahilla olla!
Saa seppeliä sidellen
He käydä nurmikolla.

TOINEN POIKA:

Siinäpä peippospari!

EMÄNTÄ:

Mitä lienevät kujeilijoita. No lapset, kohta saatte seppeleillänne


koristaa häätupaa, tässä on sisartenne sulhaset.

PIENI TYTTÖ:

Sulhaset! Nuoko pojat?

EMÄNTÄ:

Niin, ja nyt joutuun kukkanne kihlautuneiden somisteeksi.

LAPSET:

Sepä hauskaa! (Antavat seppeleen kummallekin tytölle, pojat


asettavat ne tyttöjen päähän).

ISÄNTÄ:

Miten onnellista onkaan elää näillä rauhallisilla salomailla! Täällä


on kaikki niin kaunista ja sopusointuista, yksin köyhyys ja puutekin
on täällä kaunista. Täällä olemme kaikki kuin yhtä perhettä, yksin
salon kukat, ruohot ja kanervat ottavat vaiheisiimme osaa, tuovat
onnittelunsa. Toivokaamme etteivät nämä onnen päivät koskaan
haihtuisi eikä vaihtuisi.

KAIKKI (Laulavat):

Laulu n:o 15, sävel 6, 7 ja 8.

(Sävel n:o 6.)


Anna Luoja, suo Jumala
Anna paistaa päivän kehrän,
Helottaa kuun hopeaterän
Tälle maalle mairehelle.
(Sävel n:o 7.)
Paista vierut viljaviksi
Ahot niityt armahiksi,
(Sävel n:o 8.)
Sovun soinnut sydämiin,
Rakkautta rintoihimme,
(Sävel n:o 7.)
Anna Luoja, suo Jumala,
Anna onni ollaksemme,
(Sävel n:o 8.)
Hyvin ain' eleäksemme,
Kunnialla kuollaksemme
(Sävel n:o 6.)
Suloisessa Suomessamme,
Kaunihissa Karjalassa.
*** END OF THE PROJECT GUTENBERG EBOOK SALON LAPSIA
***

Updated editions will replace the previous one—the old editions will
be renamed.

Creating the works from print editions not protected by U.S.


copyright law means that no one owns a United States copyright in
these works, so the Foundation (and you!) can copy and distribute it
in the United States without permission and without paying copyright
royalties. Special rules, set forth in the General Terms of Use part of
this license, apply to copying and distributing Project Gutenberg™
electronic works to protect the PROJECT GUTENBERG™ concept
and trademark. Project Gutenberg is a registered trademark, and
may not be used if you charge for an eBook, except by following the
terms of the trademark license, including paying royalties for use of
the Project Gutenberg trademark. If you do not charge anything for
copies of this eBook, complying with the trademark license is very
easy. You may use this eBook for nearly any purpose such as
creation of derivative works, reports, performances and research.
Project Gutenberg eBooks may be modified and printed and given
away—you may do practically ANYTHING in the United States with
eBooks not protected by U.S. copyright law. Redistribution is subject
to the trademark license, especially commercial redistribution.

START: FULL LICENSE


THE FULL PROJECT GUTENBERG LICENSE
PLEASE READ THIS BEFORE YOU DISTRIBUTE OR USE THIS WORK

To protect the Project Gutenberg™ mission of promoting the free


distribution of electronic works, by using or distributing this work (or
any other work associated in any way with the phrase “Project
Gutenberg”), you agree to comply with all the terms of the Full
Project Gutenberg™ License available with this file or online at
www.gutenberg.org/license.

Section 1. General Terms of Use and


Redistributing Project Gutenberg™
electronic works
1.A. By reading or using any part of this Project Gutenberg™
electronic work, you indicate that you have read, understand, agree
to and accept all the terms of this license and intellectual property
(trademark/copyright) agreement. If you do not agree to abide by all
the terms of this agreement, you must cease using and return or
destroy all copies of Project Gutenberg™ electronic works in your
possession. If you paid a fee for obtaining a copy of or access to a
Project Gutenberg™ electronic work and you do not agree to be
bound by the terms of this agreement, you may obtain a refund from
the person or entity to whom you paid the fee as set forth in
paragraph 1.E.8.

1.B. “Project Gutenberg” is a registered trademark. It may only be


used on or associated in any way with an electronic work by people
who agree to be bound by the terms of this agreement. There are a
few things that you can do with most Project Gutenberg™ electronic
works even without complying with the full terms of this agreement.
See paragraph 1.C below. There are a lot of things you can do with
Project Gutenberg™ electronic works if you follow the terms of this
agreement and help preserve free future access to Project
Gutenberg™ electronic works. See paragraph 1.E below.
1.C. The Project Gutenberg Literary Archive Foundation (“the
Foundation” or PGLAF), owns a compilation copyright in the
collection of Project Gutenberg™ electronic works. Nearly all the
individual works in the collection are in the public domain in the
United States. If an individual work is unprotected by copyright law in
the United States and you are located in the United States, we do
not claim a right to prevent you from copying, distributing,
performing, displaying or creating derivative works based on the
work as long as all references to Project Gutenberg are removed. Of
course, we hope that you will support the Project Gutenberg™
mission of promoting free access to electronic works by freely
sharing Project Gutenberg™ works in compliance with the terms of
this agreement for keeping the Project Gutenberg™ name
associated with the work. You can easily comply with the terms of
this agreement by keeping this work in the same format with its
attached full Project Gutenberg™ License when you share it without
charge with others.

1.D. The copyright laws of the place where you are located also
govern what you can do with this work. Copyright laws in most
countries are in a constant state of change. If you are outside the
United States, check the laws of your country in addition to the terms
of this agreement before downloading, copying, displaying,
performing, distributing or creating derivative works based on this
work or any other Project Gutenberg™ work. The Foundation makes
no representations concerning the copyright status of any work in
any country other than the United States.

1.E. Unless you have removed all references to Project Gutenberg:

1.E.1. The following sentence, with active links to, or other


immediate access to, the full Project Gutenberg™ License must
appear prominently whenever any copy of a Project Gutenberg™
work (any work on which the phrase “Project Gutenberg” appears, or
with which the phrase “Project Gutenberg” is associated) is
accessed, displayed, performed, viewed, copied or distributed:
This eBook is for the use of anyone anywhere in the United
States and most other parts of the world at no cost and with
almost no restrictions whatsoever. You may copy it, give it away
or re-use it under the terms of the Project Gutenberg License
included with this eBook or online at www.gutenberg.org. If you
are not located in the United States, you will have to check the
laws of the country where you are located before using this
eBook.

1.E.2. If an individual Project Gutenberg™ electronic work is derived


from texts not protected by U.S. copyright law (does not contain a
notice indicating that it is posted with permission of the copyright
holder), the work can be copied and distributed to anyone in the
United States without paying any fees or charges. If you are
redistributing or providing access to a work with the phrase “Project
Gutenberg” associated with or appearing on the work, you must
comply either with the requirements of paragraphs 1.E.1 through
1.E.7 or obtain permission for the use of the work and the Project
Gutenberg™ trademark as set forth in paragraphs 1.E.8 or 1.E.9.

1.E.3. If an individual Project Gutenberg™ electronic work is posted


with the permission of the copyright holder, your use and distribution
must comply with both paragraphs 1.E.1 through 1.E.7 and any
additional terms imposed by the copyright holder. Additional terms
will be linked to the Project Gutenberg™ License for all works posted
with the permission of the copyright holder found at the beginning of
this work.

1.E.4. Do not unlink or detach or remove the full Project


Gutenberg™ License terms from this work, or any files containing a
part of this work or any other work associated with Project
Gutenberg™.

1.E.5. Do not copy, display, perform, distribute or redistribute this


electronic work, or any part of this electronic work, without
prominently displaying the sentence set forth in paragraph 1.E.1 with
active links or immediate access to the full terms of the Project
Gutenberg™ License.
1.E.6. You may convert to and distribute this work in any binary,
compressed, marked up, nonproprietary or proprietary form,
including any word processing or hypertext form. However, if you
provide access to or distribute copies of a Project Gutenberg™ work
in a format other than “Plain Vanilla ASCII” or other format used in
the official version posted on the official Project Gutenberg™ website
(www.gutenberg.org), you must, at no additional cost, fee or expense
to the user, provide a copy, a means of exporting a copy, or a means
of obtaining a copy upon request, of the work in its original “Plain
Vanilla ASCII” or other form. Any alternate format must include the
full Project Gutenberg™ License as specified in paragraph 1.E.1.

1.E.7. Do not charge a fee for access to, viewing, displaying,


performing, copying or distributing any Project Gutenberg™ works
unless you comply with paragraph 1.E.8 or 1.E.9.

1.E.8. You may charge a reasonable fee for copies of or providing


access to or distributing Project Gutenberg™ electronic works
provided that:

• You pay a royalty fee of 20% of the gross profits you derive from
the use of Project Gutenberg™ works calculated using the
method you already use to calculate your applicable taxes. The
fee is owed to the owner of the Project Gutenberg™ trademark,
but he has agreed to donate royalties under this paragraph to
the Project Gutenberg Literary Archive Foundation. Royalty
payments must be paid within 60 days following each date on
which you prepare (or are legally required to prepare) your
periodic tax returns. Royalty payments should be clearly marked
as such and sent to the Project Gutenberg Literary Archive
Foundation at the address specified in Section 4, “Information
about donations to the Project Gutenberg Literary Archive
Foundation.”

• You provide a full refund of any money paid by a user who


notifies you in writing (or by e-mail) within 30 days of receipt that
s/he does not agree to the terms of the full Project Gutenberg™
License. You must require such a user to return or destroy all
copies of the works possessed in a physical medium and
discontinue all use of and all access to other copies of Project
Gutenberg™ works.

• You provide, in accordance with paragraph 1.F.3, a full refund of


any money paid for a work or a replacement copy, if a defect in
the electronic work is discovered and reported to you within 90
days of receipt of the work.

• You comply with all other terms of this agreement for free
distribution of Project Gutenberg™ works.

1.E.9. If you wish to charge a fee or distribute a Project Gutenberg™


electronic work or group of works on different terms than are set
forth in this agreement, you must obtain permission in writing from
the Project Gutenberg Literary Archive Foundation, the manager of
the Project Gutenberg™ trademark. Contact the Foundation as set
forth in Section 3 below.

1.F.

1.F.1. Project Gutenberg volunteers and employees expend


considerable effort to identify, do copyright research on, transcribe
and proofread works not protected by U.S. copyright law in creating
the Project Gutenberg™ collection. Despite these efforts, Project
Gutenberg™ electronic works, and the medium on which they may
be stored, may contain “Defects,” such as, but not limited to,
incomplete, inaccurate or corrupt data, transcription errors, a
copyright or other intellectual property infringement, a defective or
damaged disk or other medium, a computer virus, or computer
codes that damage or cannot be read by your equipment.

1.F.2. LIMITED WARRANTY, DISCLAIMER OF DAMAGES - Except


for the “Right of Replacement or Refund” described in paragraph
1.F.3, the Project Gutenberg Literary Archive Foundation, the owner
of the Project Gutenberg™ trademark, and any other party

You might also like