Please disable your adblock and script blockers to view this page

Search this blog

Saturday 30 March 2019

Getting started with Oracle JET and Jdeveloper

 I am writing some posts about Oracle JET and these posts are my learning experience so if you find any wrong info then let me know. Being an ADF developer I started using JET with JDeveloper instead of Netbeans. This is the first post and here I am sharing how to set up Oracle JET and JDeveloper to work together.

What is Oracle JET (From Docs)-

Oracle JET is targeted at JavaScript developers working on client-side applications. It's a collection of open-source JavaScript libraries along with a set of Oracle contributed JavaScript libraries that make it as simple and efficient as possible to build applications that consume and interact with Oracle products and services, especially Oracle Cloud services.



You can read more about Oracle JET

Now download Oracle JET from Oracle Technology Network - Download Oracle JET, Here I am going to use the NavDrawer template

Creating an Oracle JET Application using Oracle JDeveloper

The first step is to create a custom application in JDeveloper, Here I am using Jdeveloper12.1.3



Enter the project name and select technologies (HTML/CSS/JavaScript) to use in this project



Click on Finish and create the application.

Next is to create a public_html folder in this project, Right-click on the Project --> New --> From Gallery --> General --> Folder, Enter the folder name and click OK



Navigate to the directory where the public_html folder is created and unzip the Oracle JET folder. It'll look like this after extracting the JET bundle (We have downloaded that before)



Now In JDeveloper click on the refresh button and you can see that JET files appear under the Web Content folder



Now right click on index.html and choose Run and you can see running application in your default browser



This is the first post in this series, I'll try to post more about my experience with Oracle JET and JDeveloper.

Cheers 🙂

Saturday 16 March 2019

Send WhatsApp messages from Oracle ADF Application

 Hello Everyone

In this post, I am sharing a method to send WhatsApp messages from Oracle ADF Application using the "WhatsApp Click to Chat" feature as WhatsApp doesn't provide any official API.

Though it's an extremely simple way and we need not write a single line of code, We just need to pass some values in an URL to open WhatsApp Click to Chat console.

Created an ADF Application and a page in the view controller with two text fields and a button in it. It looks like this



and both fields are bonded to the managed bean variables

  1. <af:inputText label="Mobile No." id="it1" value="#{viewScope.SendWhatsAppBean.mobileNo}"
  2. autoSubmit="true"/>
  3. <af:inputText label="Message" id="it2" rows="2" value="#{viewScope.SendWhatsAppBean.message}"
  4. autoSubmit="true"/>

and managed bean just contain simple POJO variables

  1. package sendwhatsappadf.view.bean;
  2. public class SendWhatsAppBean {
  3. public SendWhatsAppBean() {
  4. }
  5. private String mobileNo;
  6. private String message;
  7. public void setMobileNo(String mobileNo) {
  8. this.mobileNo = mobileNo;
  9. }
  10. public String getMobileNo() {
  11. return mobileNo;
  12. }
  13. public void setMessage(String message) {
  14. this.message = message;
  15. }
  16. public String getMessage() {
  17. return message;
  18. }
  19. }

Next is to know about the browser-based WhatsApp click to chat feature, It makes use of an API URL

https://api.whatsapp.com/send?phone=&text=

Now on button click, we can pass phone number and text message in this URL to open click to chat console and in ADF we can do this using destination property of af:button.

  1. <af:button text="Send" id="b1" targetFrame="_blank"
  2. destination="https://api.whatsapp.com/send?phone=#{viewScope.SendWhatsAppBean.mobileNo}&amp;text=#{viewScope.SendWhatsAppBean.message}"
  3. partialTriggers="it2 it1"/>

In the above XML source, we can see that both values are passed from managed bean variables.

Now run and check the application. Enter mobile no., text message on the page

On click of the Send button, WhatsApp click to chat console is opened in a new browser window.



and this button will open the WhatsApp QR code scanner window, In that window scan QR code with your phone and start sending messages.



Using this method we can pass values from ADF bindings to WhatsApp URL and send messages from ADF application.

Cheers 🙂 Happy Learning

Friday 1 February 2019

Use jQuery Mask to format ADF Input Component

 In this post, I am showing a very interesting and useful jQuery plugin - jQuery Mask Plugin. We can use this plugin to format (mask) input component of ADF form with minimal code

Here I'll show you some examples of masking

Follow these steps to implement this in ADF Application

Create a page in the view controller project of Fusion Web Application and drop an input text in it.

  1. <af:inputText label="Label 1" id="it1" >
  2. </af:inputText>

Now add the jQuery library to the page under the document tag

  1. <af:resource type="javascript" source="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.1/jquery.min.js"/>
  2. <af:resource type="javascript" source="https://cdnjs.cloudflare.com/ajax/libs/jquery.mask/1.14.10/jquery.mask.js"/>

Now I am writing a simple jQuery function that masks value of the input field in date format (dd/mm/yyyy)  and add this function to page using resource tag

  1. <af:resource type="javascript">
  2. function maskUserInput() {
  3. $('input[name="it1"]').mask('00/00/0000');
  4. }
  5. </af:resource>

Add a client listener to inputText to call jQuery function as soon as the user starts typing

  1. <af:inputText label="Label 1" id="it1" >
  2. <af:clientListener method="maskUserInput" type="keyDown"/>
  3. </af:inputText>

Now run and enter some value in the input field and with typing, it'll mask user input


Now try changing the format as per your requirement, Suppose I need to mask the phone number in (+XX)-XXXXXXXXXX format, so for that, I have used this function.

  1. <af:resource type="javascript">
  2. function maskUserInput() {
  3. $('input[name="it1"]').mask('(+00)-0000000000');
  4. }
  5. </af:resource>

and output is


IP Address

  1. <af:resource type="javascript">
  2. function maskUserInput() {
  3. $('input[name="it1"]').mask('099.099.099.099');
  4. }
  5. </af:resource>

Output is


You can always change the jQuery function as per your requirement.

Cheers 🙂 Happy Learning