Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.

  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL



Over the past few years, the now open source Adobe Flex Framework has been adopted by the Java community as the preferred framework for Java RIAs using Flash for the presentation layer. Flex helps Java developers build and maintain expressive web and desktop applications that deploy consistently on most web browsers and a growing number of mobile devices.

Beginning Java and Flex describes new, simpler, and faster ways to develop enterprise RIAs. This book is not only for Java or Flex developers but for all web developers who want to increase their productivity and the quality of their development.

In this book I will show you how to develop using the most popular Java lightweight frameworks such as Spring and Hibernate, using Flex and ActionScript 3 as the view layer. Once you have mastered this new development frontier, including concepts like Dependency Injection (DI) and Object Relationship Management (ORM), you will very likely want to use them for all your projects.

Flex and Java are becoming very popular for both business and interactive applications, and they can open doors to the different branches of software development such as gaming, finance, advertising, and desktop applications of all kinds.

Who This Book Is For

If you are a developer who wants to use Java and Flex together, then this book is for you! This is especially so if you are any of the following.

  • An ActionScript/Flash developer–You really should read this book because it will show you how best to use Java in your applications. Learning Java is a great way of immersing yourself in the latest software engineering patterns and frameworks.

  • A Java developer–If you are a Java developer and know about Enterprise JavaBeans (EJBs), I really suggest you should think about using POJOs and Java frameworks such as Spring and Hibernate. By reading this book you will also pick up Flex, which puts the power of Flash into your presentation layer. Learning Flex will bring you into the world of Adobe and Flash, which promises to become increasingly important. With CS5, the next release of Flash, Adobe promises that we will be able to write ActionScript applications and compile them to native Objective-C ready to run on the iPhone!

  • A Web developer–If you are using languages such as PHP or Cold Fusion, please consider switching to Java lightweight frameworks. I guarantee that once you have mastered them your productivity will soar, and–thanks to Java–the quality of your code will get better too. For any web developer, learning Flex is a must even if you are already an Ajax or JavaFX guru. And along with Flex and ActionScript 3 you will also pick up knowledge of Flash, which at the time of this writing is everywhere.

The Book

This book has been designed to help you in three ways.

  1. First, it gives you an easily understood overview of the different technologies that we are going to use.

  2. Then it shows you how to set up your development environment.

  3. With all the prerequisites taken care of, you learn how to use each framework in turn, starting with Spring and moving on to Hibernate, then BlazeDS, then Flex, and finally putting everything together using Maven.

Here is a brief summary of what each chapter deals with.

Chapter 1 introduces you to the technologies that we are going to use, including Java, Flex, Spring, and Hibernate. It also sums up the benefits of object-oriented programming over procedural or scripting languages, and the strengths of a lightweight programming approach.

Chapter 2 introduces the sample application that we are going to use in this book and its architecture.

Chapter 3 shows you how to set up all the development tools you will need. While reasonably straightforward, this could turn out to be a painful, annoying, and time-consuming process unless you do it right. It can take a lot of time and effort to configure a complex development environment, but it really makes a difference once you have it up and running smoothly.

Chapter 4 covers the most important aspects of the Spring framework. You will learn the key concepts of DI and Inversion of Control (IoC) and how to configure Spring and inject beans into the Spring IoC container using both XML configuration and Java annotations.

Chapter 5 demonstrates how to create a Java EE data-driven application using both JDBC and ORM frameworks. I will show you the Data Access Object (DAO) pattern architecture and the difference between using "plain old JDBC" and Spring JDBC to connect to a database. Then I will explain the value of using Hibernate and Spring instead of the Spring JDBC and introduce transactions, which play an important role in Java EE development.

Chapter 6 shows you how to secure a Java application using the Spring Security framework (formerly Acegi Security). You will see how Spring Security delegates all requests to filters added by default into the Spring Security filter chain stack. Then I will show you how to add a custom authentication filter into the filter chain stack, replacing the default one. Finally, I will set out the different authentication processes using databases, LDAP repositories, and static values.

Chapter 7 gives you a complete overview of the Flex framework and the Flex Builder IDE. I will explain how to create and compile a Flex project using the Flex Builder Eclipse plug-in. Then you will learn how to listen for and dispatch Flex events, create custom components, use external CSS files, data binding, control Flash MovieClips, and more. This chapter takes you through all the concepts that I think are fundamental for starting to develop using Flex.

Chapter 8 shows you the most important ways to structure data on the Flex client and to access data on a remote server. First, I will show you how to bind ActionScript data collection to ActionScript DataGrid components and how to create a real-time search into the collection using filters. Next, I will create a Java application that provides a list of users through servlets. The Flex client will retrieve the XML using the HTTPService component. Finally, I will show you how to use the Flex RemoteObject component.

Chapter 9 introduces the BlazeDS server. You will learn how to retrieve and send data from a Flex application to a Java application and how to exchange real-time messages among different clients using the BlazeDS server.

Chapter 10 puts it all together–Spring, Hibernate, BlazeDS, and Flex. We will create a Flex-Spring-Hibernate project using the Flex-Spring-Hibernate Maven archetype. The archetype creates the entire project directory structure containing all the Spring, Hibernate, and BlazeDS configuration and properties files. It also adds all the packages usually needed for this kind of application using the Model View Controller (MVC) and DAO patterns. In this chapter, I cover all the most important aspects of Flex-Spring-Hibernate-Maven development. You can reuse the same archetype to start your own project, and you'll see how your developer productivity will quickly increase.

Java and Flex let you create amazing applications using object-oriented languages and the latest software engineering techniques, making you not just a better developer but also a better software engineer.

  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint