Free Programming Books
Free download ebooks on computer and programming

Free Java Ebook "Beginning Java EE 5 from Novice to Proffesional" Sample Chapter

Beginning Java EE 5: From ..
Download Chapter 1 : Java EE Essentials.
Download chapter

This book shows you how to harness the power of Java EE 5, and examines how the pieces of the new platform fit together. The authors surpass merely explaining how to code a JSP or an EJB; instead, they compare these APIs at length for your ultimate benefit. You will come to learn when and where to use these APIs, employ best practices for using them, and understand their strengths and weaknesses.

Hands-on tutorials are also included, along with clear explanations and working code examples. You will grow to take the next step-from writing client-side desktop applications to writing enterprise applications. You will also learn how to use the individual APIs and tools in the Java EE 5 platform, and how to merge these to create your own enterprise applications.

This book shows you how to harness the power of Java EE 5, and examines how the pieces of the new platform fit together. The authors surpass merely explaining how to code a JSP or an EJB; instead, they compare these APIs at length for your ultimate benefit. You will come to learn when and where to use these APIs, employ best practices for using them, and understand their strengths and weaknesses.

Hands-on tutorials are also included, along with clear explanations and working code examples. You will grow to take the next step-from writing client-side desktop applications to writing enterprise applications. You will also learn how to use the individual APIs and tools in the Java EE 5 platform, and how to merge these to create your own enterprise applications.

< < prev next > >

What Is Java EE?

Since you're reading this book, you obviously have some interest in Java EE, and you probably have some notion of what you're getting into. For many fledgling Java EE developers, Java EE equates to Enterprise JavaBeans (EJBs). However, Java EE is a great deal more than just EJBs. While perhaps an oversimplification, Java EE is a suite of specifications for APIs, a distributed computing architecture, and definitions for packaging of distributable components for deployment. It's a collection of standardized components, containers, and services for creating and deploying distributed applications within a well-defined distributed computing architecture. Sun's Java web site says, " Java Platform, Enterprise Edition 5 (Java EE 5) defines the standard for developing component-based multitier enterprise applications."

As its name implies, Java EE is targeted at large-scale business systems. Software that functions at this level doesn't run on a single PC-it requires significantly more computing power and throughput than that. For this reason, the software needs to be partitioned into functional pieces and deployed on the appropriate hardware platforms. That is the essence of distributed computing. Java EE provides a collection of standardized components that facilitate software deployment, standard interfaces that define how the various software modules interconnect, and standard services that define how the different software modules communicate.

How Java EE Relates to J2SE

Java EE isn't a replacement for the Java 2 Standard Edition (J2SE). J2SE provides the essential language framework on which Java EE builds. It is the core on which Java EE is based. As you'll see, Java EE consists of several layers, and J2SE is right at the base of that pyramid for each component of Java EE.

As a Java developer, you've probably already learned how to build user interfaces with the Swing or Abstract Window Toolkit (AWT) components. You'll still be using those to build the user interfaces for your Java EE applications, as well as HTML-based user interfaces. Since J2SE is at the core of Java EE, everything that you've learned so far remains useful and relevant. In addition, Java EE provides another API for creating user interfaces. This API is named JavaServer Faces (JSF) and is one of the newest Java EE technologies. You'll also see that the Java EE platform provides the most significant benefit in developing the middle-tier portion of your application-that's the business logic and the connections to back-end data sources. You'll use familiar J2SE components and APIs in conjunction with the Java EE components and APIs to build that part of your applications.

Why Java EE?

Java EE defines a number of services that, to someone developing enterprise-class applications, are as essential as electricity and running water. Life is simple when you simply turn the faucet and water starts running, or flip the switch and lights come on. If you have ever been involved with building a house, you know that there is a great deal of effort, time, and expense in building the infrastructure of plumbing and wiring, which is then so nicely hidden behind freshly painted walls. At the points where that infrastructure is exposed, there are standard interfaces for controlling (water faucets and light switches, for example) and connecting (power sockets, lamp sockets, and hose bibs, for example) to the infrastructure.

Suppose, though, that the wiring and plumbing in your home wasn't already there. You would need to put in your own plumbing and electricity. Without standard components and interfaces, you would need to fabricate your own pipes, wiring, and so on. It would be terrifically expensive and an awful lot of work.

Similarly, there is a great deal of infrastructure required to write enterprise-class applications. There are a bunch of different system-level capabilities that you need in order to write distributed applications that are scalable, robust, secure, and maintainable. Some vital pieces of that infrastructure include security, database access, and transaction control. Security ensures that users are who they claim to be and can access only the parts of the application that they're entitled to access. Database access is also a fundamental component so that your application can store and retrieve data. Transaction support is required to make sure that the right data is updated at the right time. If you're not familiar with some of these concepts, don't worry-you'll be introduced to them one at a time throughout this book.

Putting in a distributed computing infrastructure-the plumbing and wiring of an architecture that supports enterprise applications-is no simple feat. That's why Java EE-based architectures are so compelling; the hard system-level infrastructure is already in place. But why not custom build (or pay someone to custom build) an infrastructure that is designed around your particular application? Well, for starters, it would take a fantastic amount of time, money, and effort. And even if you were to build up that infrastructure, it would be different from anyone else's infrastructure, so you wouldn't be able to share components or interoperate with anyone else's distributed computing model. That's a lot of work for something that sounds like a dead end. And if you were lucky enough to find a vendor that could sell you a software infrastructure, you would need to worry about being locked into that single vendor's implementation, and not being able to switch vendors at some point in the future.

The good news is, no surprise, that Java EE defines a set of containers, connectors, and components that fill that gap. Java EE not only fills the gap, but it's based on well-known, published specifications. That means that applications written for Java EE will run on any number of Java EE-compliant implementations. The reference implementation supplied with the Java EE Software Development Kit from Sun (Java EE SDK) provides a working model that we'll use throughout this book, since it's the implementation that Sun has built from the specification and is freely available. In the next chapter, you'll get an introduction to installing and testing the Java EE SDK.