How to Create a Simple ASK Application with Oracle JDeveloper 10.1.3

This topic describes how to use JDeveloper to create a simple Ask application. These applications are deployed on an Ask server, which enables messaging devices to interact with web applications. JDeveloper 10.1.3 does not provide design-time support for creating Ask applications. However, there are workaround solutions for the same.

Contents

  1. Introduction to Ask
  2. Example of Ask Messaging
  3. Creating a Simple Ask Application Using JDeveloper

Introduction to Ask

Ask Server is a component that enables messaging devices to interact with web applications. It provides a way for users of messaging devices to ask for information, hence the name.

Ask Server Architecture

Oracle Application Server Wireless presents a framework and a runtime environment for developing wireless and voice applications accessed through a browser-based device such as a device with a WAP or XHTML browser, or through messaging-protocol-based devices such as mobile phones with SMS. Ask Server is the wireless component that enables the messaging protocol-based devices to access these wireless applications.

Conventionally, the entry point into an application server is through the HTTP protocol. This limits applications built on an application server to only clients with web capability. This server restriction is a problem for mobile market users, because the vast majority of mobile users does not have web access. These users, however, are almost certain to have some kind of message capability (such as e-mail or SMS). With the introduction of Ask Server, applications can also be accessed through messaging protocols other than HTTP, such as e-mail or SMS. The developers the build only the application logic, while Oracle Application Server Wireless establishes the proper connection, performs session management, and interprets user requests. An application is invoked the same way regardless of which protocol handles the incoming requests, offering complete transparency to application developers to allow access to their services.

Example of Ask Messaging

Here's an example of how a device user can access a web application.

To access a Stock Quote application, a user having an SMS-enabled phone can do the following:

  1. Create a message and specify the destination address provided by the application portal, for example, 223.
  2. Specify the text stk orcl in the message body.
    Note: The text stk is a short name to identify a stock quote application and orcl is the argument required by the application.

The server then processes the message and sends back the result with another message.

Creating a Simple Ask Application

This topic takes you through the steps required to create a "Hello World" application from within JDeveloper. You need to perform the following tasks:

  1. Create an Empty Application and Project
  2. Create a new JSF JSP File
  3. Create a Java Bean
  4. Create a Managed Bean
  5. Add ADF Components to the JSF JSP File
  6. Test the JSF JSP File
  7. Add a Render Kit and a View Handler to the ADF Faces Configuration
  8. Add Ask Render Kit Implementation and ADF Share as Part of the Library
  9. Create a Deployment Profile
  10. Deploy the Application

Create an Empty Application and Project

Create an application and project.

  1. Open the New Gallery by choosing File then choose New .
  2. In the New Gallery, in the C ategories tree, select General.
  3. In the Items list, double-click Application.

New Gallery: General category: Application item

  1. In the Create Application dialog, enter HelloApp as the application name and click OK.

Create Application dialog

  1. In the Create Project dialog, enter HelloPrj as the project name and click OK.

Create Project dialog

Back to the main task

Create a new JSF JSP File

Create a JSF JSP file.

  1. In the Applications Navigator, right-click the project you just created and select New .
  2. In the New Gallery, expand the Web Tier node and select the JSF category.
  3. In the Items list, double-click JSF JSP.

New Gallery: Web Tier > JSF category: JSF JSP item

  1. On the Welcome page, click Next .
  2. On the Web Application page, select S ervlet 2.4\JSP 2.0 (J2EE 1.4) and click Next .
  3. On the JSP File page, select JSP D ocument , enter Hello.jspx as the filename, and click Next .

Create JSF JSP wizard: JSP File page

  1. On the Component Binding page, select Do Not Automatically Expose UI Components in a Managed Bean , and click Next .
  2. On the Error Page Options page, click Next .
  3. On the Tag Libraries page, use the right shuttle button to move ADF Faces Components and ADF Faces HTML from the Available Libraries list to the Selected Libraries list, and click F inish.

Create JSF JSP wizard: Tag Libraries page

  1. On the HTML Options page, click Next .
  2. On the Finish page, click Finish to create the JSF JSP file.

Back to the main task

Create a Java Bean

Create a Java Bean, to store the input name.

  1. In the Applications Navigator, right-click the project you just created and select N ew.
  2. In the New Gallery, expand the General node and select the JavaBeans category.
  3. In the Items list, double-click Bean.

New Gallery: General > JavaBeans category: Bean item

  1. In the Create Bean dialog, enter HelloBean as the name, select java.lang.Object from the Extends dropdown list, and click OK.

Create Bean dialog

  1. In the source editor for the HelloBean.java file, add the following code after the bean constructor:

    public String getName()
    {
    return name;
    }
    public void setName(String name)
    {
    this.name = name;
    }
    private String name;

Storing the input name

Back to the main task

Create a Managed Bean

Create a managed bean inside the ADF Faces configuration.

  1. In the Applications Navigator, expand the Web Content tree under the project you created.
  2. Expand the WEB-INF tree and select the faces-config.xml node.
    The structure of the faces-config.xml file will appear in the Structure window.

  1. In the Structure window, right-click Faces Config and choose Insert inside Faces Config then choose mana ged-bean .
  2. In the Create Managed Bean dialog, enter Hello as the name and mypackage.HelloBean as the class, and click OK.

Create Managed Bean dialog

  1. In the Structure window, expand the managed bean node and right-click Scope.
  2. Choose Insert after Scope then choose m anaged-property .
  3. In the Create Managed Property dialog, enter name as the name and java.lang.String as the class, and click OK.

Create Managed Property dialog

  1. In the Structure window, right-click the managed property node and select Pr operties .
  2. In the managed-property Properties dialog, enter #{param.name} as the value and click OK.

managed-property Properties dialog

Back to the main task

Add ADF Components to the JSF JSP File

Add ADF components to the JSF JSP file.

  1. In the Applications Navigator, double-click Hello.jspx.
  2. In the Structure window, delete the jsp:output and html nodes.

Original Structure view of Hello.jspx

  1. Right-click f:view and choose Insert inside f:view then choose AD F Faces HTML then choose Ht ml .
  2. Right-click afh:html and choose Insert inside afh:html then choose AD F Faces HTML then choose Head .
  3. Right-click afh:head - Title 1 and choose Pr operties .

Structure view: Hello.jspx with new HTML and Head tags

  1. In the Head Properties dialog, enter Hello App as the title property and click OK.

Head Properties dialog

  1. In the Structure window, right-click afh:html and choose Insert inside afh:html then choose AD F Faces HTML then choose Body .
  2. Right-click afh:body and choose Insert inside afh:body then choose A DF Faces Core.
  3. In the Insert ADF Faces Core Item dialog, select Form and click OK.

Insert ADF Faces Core Item dialog: Insert Form element

  1. In the Structure window, right-click af:form and choose Insert inside af:form then choose ADF Faces Core.
  2. In the Insert ADF Faces Core Item dialog, select OutputText and click OK.

Insert ADF Faces Core Item dialog: Insert OutputText element

  1. In the Structure window, right-click af:outputText - outputText1 and choose Pr operties .
  2. In the OutputText Properties dialog, enter Hello (with a trailing space) as the value property and click OK.
    Note: The trailing space is required to differentiate between the static output text Hello and the subsequent output parameter, which we will pass to the application.

OutputText Properties dialog: static value

  1. In the Structure window, right-click the output text node and choose Insert after af:outputText - Hello then choose ADF Faces Core .
  2. In the Insert ADF Faces Core Item dialog, select OutputText and click OK.
  3. Right-click af:outputText - outputText2 and choose Pr operties .
  4. In the OutputText Properties dialog, delete the default value and click Bind .
  5. In the Bind to Data dialog, in Variables navigation tree, expand JSF Managed Beans and Hello, and select name.
  6. Click the right shuttle button to create an EL expression using the variable and click OK.

Bind to Data dialog

  1. In the OutputText Properties dialog, click OK.

OutputText Properties dialog: value property bound to data

Back to the main task

Test the JSF JSP File

Test run the application.

  1. Choose Run then choose R un Hello.jspx .
    This launches the default web browser and displays the text Hello when no parameter value is passed to the page.

Test output: static value

  1. Append ?name=John to the URL in the address bar and press Enter.
    The web browser will now display the text Hello John.

Test output: with parameter

Back to the main task

Add a Render Kit and a View Handler to the ADF Faces Configuration

Configure a Renderkit onto faces-config.xml.

  1. In the Applications Navigator, select the faces-config.xml node.
    The structure of the faces-config.xml file will appear in the Structure window.
  2. In the Structure window, right-click the managed bean node and choose Insert after managed-bean - Hello then choose render-kit .
  3. In the Create Render Kit dialog, enter oracle.adf.async as the ID and oracle.adfinternal.view.faces.ask.renderkit.AsyncRenderKit as the class, and click OK.

Create Render Kit dialog

  1. In the Structure window, Double-click the application node.
  2. In the application Properties dialog, enter oracle.adfinternal.view.faces.ask.application.AsyncViewHandlerImpl as the view handler.

application Properties dialog

Back to the main task

Add Ask Render Kit Implementation and ADF Share as Part of the Library

Add the Ask render kit implementation as part of the library.

  1. In the Applications Navigator, right-click the HelloPrj node and choose Proj ect Properties .
  2. In the Project Properties dialog, in the navigation tree, click Libraries.

Project Properties dialog: Libraries page

  1. On the Libraries page, Click Add Li brary .
  2. In the Add Library dialog, click New .

Add Library dialog

  1. In the Create Library dialog, click Add Entry .

Create Library dialog: Ask Implementation

  1. In the Select Path Entry dialog, navigate to wireless/lib under the JDeveloper home directory, select ask-adf-faces-impl.jar, and click Select.

Select Path Entry dialog: Ask Implementation Library

  1. In the Create Library dialog, click OK.
  2. In the Add Library dialog, click New .
    Note: We need to repeat some steps to add the ADF Share library.

Add Library dialog: Ask Implementation

  1. In the Create Library dialog, click Add Entry .
  2. In the Select Path Entry dialog, navigate to BC4J\lib under the JDeveloper home directory, select adfshare.jar, and click Select.

Select Path Entry dialog: ADF Share Library

  1. In the Create Library dialog, click OK.
  2. In the Add Library dialog, click OK.
  3. In the Project Properties dialog, click OK.

Project Properties dialog: Libraries page

Back to the main task

Create a Deployment Profile

Create a deployment profile for the application.

  1. From the main menu, choose Run then choose Deplo y then choose New Deployment Profile .
  2. In the New Gallery, expand the General node and select the Deployment Profiles category.
  3. In the Items , double-click WAR File.

New Gallery: General > Deployment Profiles : WAR File

  1. In the Create Deployment Profile -- WAR File dialog, enter HelloApp as the name and click OK.

Create Deployment Profile -- WAR File dialog

  1. In the WAR Deployment Profile Properties dialog, in the navigation tree, expand the File Groups node, expand the WEB-INF/lib node and select Contributors.
  2. On the Contributors page, select the ADF Common Runtime, Adfshare.jar and Adfshare.jar checkboxes, and click OK.

WAR Deployment Profile Properties dialog

Back to the main task

Deploy the Application

Deploy the application.

You can now use this war file to deploy the application on the default OC4J server.

For information on how to deploy the Ask Server to non-Oracle application servers, please refer to How To Deploy Ask on Supported Application Servers

Back to the main task

false ,,,,,,,,,,,,,,,