Developing Web Applications with Oracle ADF Essentials
上QQ阅读APP看书,第一时间看更新

Preface

Oracle ADF is the most productive framework available today for building data-handling web applications. With just a little training (like you can get from this book), you will be able to build fully-functional applications to meet a wide variety of needs.

Until September 2012, this powerful tool was reserved for organizations and projects able to pay for an Oracle WebLogic Server license, which is not quite cheap. But that month, after years of badgering by ADF enthusiasts, Oracle finally decided to make a free, slightly limited version of Oracle ADF available to everyone.

This means the fastest, easiest, and cheapest way of building a data-handling application today is with the technology stack described in this book:

  • The free MySQL database
  • The free GlassFish application server
  • The free ADF Essentials toolkit
  • The free JDeveloper development tool

The prescription

When pharmaceutical companies develop drugs, they are targeting specific ailments or situations. Similarly, IT development platforms and frameworks target specific use cases. And the "sweet spot" for the ADF framework is data-handling applications.

What is a data-handling application? It is an application whose primary function is to gather data, process them, and display them back to the user as tables or graphs. Examples of data-handling applications are membership databases, project and task management, or accounting programs.

With very powerful declarative features, you can build most of your application without having to write any code, and the advanced user interface components make it easy to build an attractive user interface including interactive graphical displays of your data.

Off-label use

After release, some drugs are found to be potentially useful for other conditions than those for which they were developed and tested. This is called "off-label use" — using the drug for something that it was not intended for.

A similar situation occurs in the development of IT systems –– developers choose a tool that is a brilliant choice for one type of applications and try to use it for other types.

The classic case of "off-label use" of ADF is to build an application where you require absolute control over every pixel and every interaction. Such control is often possible to achieve with ADF, but it takes a big effort and requires deep modifications to the core of the framework.

Allergies

In medicine, some people are allergic to certain medicines and should not be given them.

Similarly, there are some types of highly interactive applications like games or photo editing that are definitely unsuited for ADF.

What's not there

ADF Essentials contains everything you need to build a data-handling application –– but of course, there has to be some additional features only available to enterprise customers with a full ADF license.

Some of the things not included in ADF Essentials include ADF Mobile, ADF Security (which is based on Oracle Platform Security Services, available only in WebLogic), Web Service Data Controls, ADF Desktop Integration, and so on. Refer to the ADF Essentials "Frequently Asked Questions" document for the full list.

However, it is worth repeating that everything you need in order to build data-handling applications is there. Actually, everything is there –– the restriction is only a legal and licensing issue.

The sample application

Throughout this book, a sample application for a DVD rental shop is built. You can follow along in JDeveloper as you read, learning ADF hands-on.

The data model is the standard sakila database schema that comes with MySQL. The part we use consists of the customer, film, inventory, and rental tables –– their relationship looks as shown in the following diagram:

We will build three application screens: one simple screen for registering a rental, and two connected screens for searching for a customer and registering a return. These two screens look as shown in the following diagram:

What this book covers

Chapter 1, My First ADF Essentials Application, shows you how to install all the software and build a very simple application to prove that everything works.

Chapter 2, Creating Business Services, describes what Business Components are and how they are used in the example application. No code required!

Chapter 3, Creating Task Flows and Pages, shows you how to build ADF task flows that control the flow of your application and how to build the ADF pages where the user interacts with the data. Still no code required!

Chapter 4, Adding Business Logic, explains how to add business logic to your application –– this is where you'll have to write some actual Java code to implement functionality that ADF does not offer declaratively.

Chapter 5, Building Enterprise Applications, demonstrates how you go about building a larger application, using subsystems and ADF libraries to divide a big application into more manageable parts. We'll quickly build the whole DVD rental application again in this chapter using proper enterprise methodology.

Chapter 6, Debugging ADF Applications, shows you how to use ADF logging and debugging features to troubleshoot any problems you might experience during your ADF development.

Chapter 7, Securing an ADF Essentials Application, implements Apache Shiro to secure your application. Remember that there were some ADF-specific security features not part of ADF Essentials? This chapter shows you a fully-functional alternative.

Chapter 8, Build and Deploy, demonstrates how to use Apache Ant to create build scripts that compile, build, and deploy an entire enterprise application, including subsystems and ADF libraries.

What you need for this book

This book uses the following software:

  • MySQL database version 5.6
  • GlassFish application server 3.1
  • ADF Essentials 11.1.2.4
  • JDeveloper 11.1.2.4

Chapter 1, My First ADF Essentials Application, explains where to get the software, how to install it, and how to configure all the parts to work together.

Who this book is for

This book is for every web developer who wants to build data-handling applications quickly and efficiently. The book does not require any preconditions –– even beginners can use the powerful declarative features of ADF to build basic applications completely without programming.

Most real-life applications will of course require some programming to implement the business logic that is specific to your application. ADF uses Java to implement business logic, so a basic understanding of Java programming is required for most applications. A bit of knowledge about web applications in general will also be beneficial.

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, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles are shown as follows: "Just like a SELECT statement can join data from multiple tables, a view object can join data from multiple entity objects".

A block of code is set as follows:

protected void doDML(int operation, TransactionEvent e) {
  super.doDML(operation, e);
}

When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold:

if (operation == DML_INSERT) {
  String insStmt = "{call insertActor (?,?)}";
  cstmt = getDBTransaction().createCallableStatement(insStmt, 0); 
  try { cstmt.setString(1, getFirstName());
    cstmt.setString(2, getLastName());
    cstmt.execute();
  }
  catch (Exception ex) {
  ...
  }

New terms and important words are shown in bold. Words that you see on the screen, in menus or dialog boxes for example, appear in the text like this: "clicking on the Next button moves you to the next screen".

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 may have disliked. Reader feedback is important for us to develop titles that you really get the most out of.

To send us general feedback, simply send an e-mail to , and mention the book title via 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 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 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 would 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 on our website, or added to any list of existing errata, under the Errata section of that title. Any existing errata can be viewed by selecting your title from http://www.packtpub.com/support.

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 us with the location address or website name immediately so that we can pursue a remedy.

Please contact us at 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

You can contact us at if you are having a problem with any aspect of the book, and we will do our best to address it.