ADF in Action (11g): Prepare Yourself for the UI

A Simple Test Application

Before we start to develop the UI, we test the deployment of a simple Hello World ADF Faces application. This helps to find possible errors and problems very early. OK, here we go.

  1. To make things easy we start with a new application. In your JDeveloper 11g Application Navigator go to the list of applications and select the New Application ... entry from the drop down.
  2. In the Create Generic Application wizard, set the Application Name to ADFHelloWorld. Select the Application Template: Generic Application and click on Next.
  3. Now enter HelloWorld for the Project Name and click on Finish.
  4. Select the HelloWorld project and open the Context Menu, and chose New...
  5. In the All Technologies tab scroll down until you find JSF, select it, select JSF Page from the Items area, and click OK.
  6. In the Create JSF Page window, set the File Name to helloworld.jspx, for Use Page Template select /oracle/templates/threeColumnTemplate.jspx, check Create as XML Document (*.jspx), and click on OK.
  7. Open the Component Palette and select ADF Faces from the drop down box.
  8. In the Common Components accordion find the Output Text component and drag it to the center area in the helloworld.jspx.
  9. Find the Output Text Property Inspector and set the Value to Hello World! Expand Style and set the Size to xx-large.
  10. To see the results in a browser, select the helloworld.jspx, open the Context Menu and select Run

Deploy to WebLogic 10.3

During development we use the integrated WebLogic server and everything works fine. But will the same be true for a standalone WebLogic 10.3 server? Not necessarly. We have to do some steps before we can successfully deploy to the WebLogic server.

During installation of JDeveloper 11g you might have noticed that you can select an existing WebLogic server installation directory. This is necessary to install the ADF runtime to the WebLogic server in question.

  1. Start the JDeveloper 11g Installation Wizzard.
  2. In Choose Middleware Home Directory select Use an existing Middleware Home and select the home directory of your WebLogic server.
  3. In Choose Products and Components uncheck everything but Application Development Framework Runtime
  4. The wizard will install all the necessary libraries in a jdeveloper directory underneath your Middleware Home
  5. With the WebLogic Domain Wizard create a new domain or update an existing domain with the Application Development Framework included.

Are we ready? No, unfortunately not. We have to do create a Deployment Profile to be able to deploy it and also need to setup an Application Server connection.

The Deployment Profile

Creating an Deployment Profile has not changed. But we mention all the steps again.

  1. Select the HelloWorld project, open the Context Menu and select the New entry.
  2. In the New Gallery scroll up to the General group and find the Deployment Profiles sub group.
  3. From Items select the WAR File entry and click OK
  4. Use helloworld as Deployment Profile Name
  5. In the Edit WAR Deployment Profile Properties window select Specify Java EE Webb Context Root and set it to helloworld. Click OK.

The Weblogic Deployment Descriptor

It is necessary to enable the JSF and JSTL libraries with a WebLogic-specific deployment descriptor. For this case we use the deployment descriptor for the web application:

  1. Select the HelloWorld project, open the Context Menu and select the New entry.
  2. In the New Gallery scroll to the General group and find the Deployment Descriptors sub group.
  3. From Items select WebLogic Deployment Descriptor, click OK, select weblogic.xml and click OK
  4. Open the weblogic.xml and make sure it looks like this:
<?xml version="1.0" ?>
<weblogic-web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.bea.com/ns/weblogic/weblogic-web-app.xsd"
xmlns="http://www.bea.com/ns/weblogic/weblogic-web-app">
  <library-ref>
    <library-name>jstl</library-name>
  </library-ref>
  <library-ref>
    <library-name>jsf</library-name>
  </library-ref>
</weblogic-web-app>

The Application Server Connection

As mentioned in previous posts, JDev 11g offers us two options to specify Connections to various server types. Unfortunately, the application-specific option for Application Server Connections is not available. These are only available as IDE Connections.

  1. Open the Resource Palette and expand the IDE Connections accordion.
  2. Click on the Folder with Star icon and select New Connection > Application Server
  3. Follow the wizard to specify all the information requested. Do not forget to Test the connection.

Deploy the Sample

Great, we are now ready to deploy the sample application.

  1. Select the HelloWorld project, open the Context Menu, select Deploy, select helloworld, select to and find the application server connection you have just created.
  2. You can now run the application by pointing your browser to the URL http://hostname:7001/helloworld/faces/helloworld.jspx

Caveat

Sometimes the deployment does not work as expected. I have encountered these:

  1. Remote WLS servers - You have to create a WAR or an EAR file, copy it to the remote server and deploy it through the WLS Console (http://hostname:7001/console)
  2. WLS on Windows - Sometimes the deployment on a standalone WLS 10.3 on Windows XP doesn't work correctly. I am investigating this and will post a solution.
Comments:

Post a Comment:
Comments are closed for this entry.
About

This is my blog for things I found useful during my work as Senior Solution Architect for Identity Management and Service-oriented Architecture at Oracle. All text expressed on this blog is my own opinion and not related to my employer.

Search

Top Tags
Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today