Foreword

1 Who Is This Book For?

The workshop contained within this book aims to offer an introduction to Java Enterprise Edition 7 (Java EE 7). Our starting point for this complex topic will be the web profile introduced in Java EE 6: a standardized subset of Java EE APIs that are intended specifically for web applications. This book will guide the reader through the step-by-step development of a web application based on web profile technologies. The end stage of development will also see us use some APIs that are not part of the web profile, but are of high practical relevance for professional applications.

Though this book will also impart plenty of information regarding the ways in which Java EE 7 has been improved in comparison to its predecessor, it has been envisioned primarily for beginners seeking a comprehensive introduction to Java EE in the current version rather than for experienced Java developers wishing to bring their knowledge up to date.

The book’s success depends on the possession of some general and some more specialist areas of knowledge by the reader.

General requirements include:

  • good knowledge of object-oriented programming with Java
  • basic knowledge of the Java SE API
  • basic knowledge of web technologies (HTTP, HTML, web server)
  • basic knowledge of databases and XML
  • basic knowledge of distributed systems
  • basic operating system knowledge

Special requirements include:

  • basic knowledge of Java annotations
  • basic knowledge of an integrated development environment for Java
  • knowledge of the operating system’s command line
  • basic principles of SQL

If you are not yet familiar with these more specialized concepts, you can pick up the necessary knowledge quite quickly in parallel to your study of the book. The general requirements, however, are somewhat broader in scope and represent knowledge that can generally only be acquired over a longer period of study.

We envision this book as being of particular use to the following groups (though this list is in no way intended to be exhaustive):

  • Web developers who possess Java knowledge but who have so far worked predominantly with alternative web programming languages such as PHP and ASP.NET
  • Java developers whose work to date has involved developing for other platforms (e.g. desktop or mobile devices)
  • Students of computer science or business information systems in the more advanced semesters of their Bachelor degree

Java EE is a powerful programming platform, and beginners can easily feel overwhelmed. This book aims, wherever possible, to “skim off” the more complex aspects of each topic and afford the beginner an overview of key information. This is intended to ease the reader in and maintain high levels of motivation.

Some of you reading this book will doubtlessly already be Java EE experts. In this case, we ask for your understanding regarding any lack of completeness that has resulted unavoidably from simplifications made. This is a compromise we have accepted consciously, both for didactic purposes and on the basis that a sound introduction leaves plenty of time for finer details and alternative methods later. The knowledge base afforded you by this book will also enable you to quickly get to grips with new aspects of Java EE.

2 A Note on the Second Edition

Java EE has been available in Version 7 since the second quarter of 2013. Oracle’s reference implementation is the Glassfish application server in Version 4. The time between the final release of a Java EE specification and the release of a marketable Java EE application server can be very lengthy. While Glassfish 4 was the only Java EE 7 application server at the time of writing the first edition of this book, WildFly 8 (the successor to JBoss AS 7) has since emerged as another prominent implementation. On grounds of the widespread use of JBoss AS 7, we consider WildFly 8 to be of the highest practical relevance for beginners, which is why it is used for the majority of the development in this book. In the last iteration of the software development cycle, we will also deploy the Glassfish 4 application server. This is intended to broaden the learner’s competence regarding the use of tools. This list of execution environments is rounded off by OpenShift, the PaaS offering from Red Hat, which enables the user to deploy Java EE 7 applications in the cloud.

While Version 7 includes many improvements to important component specifications (JSF, CDI, JPA, EJB), it is not important for beginners to understand them fully at this point. This second edition of the book does not purport to educate readers in using these improved features, but to provide them with a sound and comprehensive introduction to Java EE as a whole. That being said, we will be deploying the most significant and exciting of these new innovations, including the new REST API and WebSockets with HTML5. Theoretical sections at the end of every chapter will also address aspects of and improvements to Java EE 7 that are not encountered in the development phases.

New for the second edition is instruction regarding features of Java EE 7 related to JavaServer Faces, including resource library contracts and HTML5 support. Additionally, the second edition has taken steps to incorporate the internationalization of Java EE applications, and a new chapter has been added on functional tests.

We believe that the concept and scope of the book renders it ideal for newcomers to Java EE. It is intended to provide the reader with a broad but controlled introduction to the topic: to familiarize them with new possibilities offered by Java EE 7, to enable them to try out the highlights and to equip them with the skills and knowledge to work with a range of commonly used open source products.

3 Additional Information On the Book

The complete source code for the applications developed within this book (“My-Aktion” [My Campaign] and “My-Aktion-Monitor” [My Campaign Monitor]) can be found on GitHub, the popular community platform for developers. Section A.2 in the appendix contains information on how Git should be used to gain access to the code.

<!–
A website has also been created to accompany the book. On it can be found supplemental information regarding the book and the use of Java EE technologies.
http://www.javaee7.de/tutorial
–>

4 Structure of the Book

Chapter 1 is intended to afford the reader a brief overview of Java EE. In it, we will develop a target architecture to accompany us through the rest of the book.

In Chapter 2,  we move to look at the development and execution environment for our software project. We will learn how to install WildFly and how to create an initial Java EE project and deploy it on WildFly. This will be accomplished with the help of Maven, a widely used project configuration management tool.

The Appendix contains a supplementary section, A.1, that is intended to be used in parallel to Chapters 1 and 2 by interested readers wishing to gain a quick understanding of Java EE applications at the source code level.

Chapter 3 describes the application that is to be created. The description will focus on functional use cases and their processes as well as on domain classes and associated graphical interfaces.

The development of the software will be accomplished in multiple iterations. Each chapter will cover one iteration and will end with a range of tasks. The first iteration begins in Chapter 4 with the web interface. The application will be fully operational upon completion of the iteration described in Chapter 8. Chapter 9 will see us make use of a further application server, Glassfish 4, to implement the final use case.

Chapter 10 is devoted to the topic of “Java EE 7 and the Cloud”. While full standardization in this regard is expected to be accomplished with the release of Java EE 8, a proprietary cloud offering for Java EE applications is already in existence. We will show you how to deploy the “My-Aktion” application for the cloud provider OpenShift. OpenShift offers WildFly instances in the cloud, enabling the distribution of Java EE applications on the web without the operation of a corresponding server.