Integrating QAFE with a JSP Frame using server-side processing

In previous blogs, we explained how to embed a Oracle Forms applet in a QAFE application and how to communicate between the applet and the QAFE application using Javascript. This uses the newly introduced call-script built-in and calling QAFE events from javascript. This only works using client-side processing. This blog will explain how to pass values from an embedded page back to the QAFE application using server-side processing.

Take for example this sample application including a refresh-button, a two textfields and a frame. The frame contains a textfield and a button. When the button within the frame is pressed, the value of the text field within the frame is passed to the QAFE application data store. By pressing the refresh button, the text fields will be filled in based on the value within the frame.

The image below describes the basic flow of the application. The QAFE application will embed a JSP page, which includes a text field and a button. When clicked on the button, a Javascript function is executed for storing the text field value. This function will send a request to a servlet to call the QAFE Engine storing the value into the application store.  When the value has been stored in the application store, the QAFE application can use that value for example to set that value to a text field as in the example.

Application store flow

As described above a Java servlet is used to pass information from the JSP page to the QAFE application. When opening up the QAFE application in the browser, a window session ID is generated to give the user a unique session. This window session ID should be used to store values in the application store. It is available in the HTML-code of the web page which includes the QAFE application as windowId. When passing the value through Javascript, the session ID should also be passed.

The code snippet below describes how to store the values into either the global store (application-wide) or the user store (only within a window). An ApplicationContext needs to be initiated to know which application store to use. Two dependencies (qafe-core and qafe-presentation) need to be imported. See Github for more information.

In this example, value “dummyValue” is stored in the global store with name “dummyValue”. The input variable is available in the user store with name “inputField”. These values can now be used in other events.

Thank you for reading this blog! More technical details and additional code snippets can be found on Github.

Blog by: Arvind Mohabir

Leave a Reply

Your email address will not be published. Required fields are marked *