Problem solve Get help with specific problems with your technologies, process and projects.

Using Java for Web-deployed Forms

This tip explains why Java is a compelling solution when working with Web-deployed Forms, and how to work with pluggable Java components and Java methods.

This tip is brought to you by the International Oracle Users Group (IOUG). It has been excerpted from the presentation "Top tips for Web-deployed Forms," originally presented at IOUG! Live 2003 by Peter Koletzke. Become a member of the IOUG to access a repository of technical content created for Oracle users by Oracle users.


USE JAVA

Forms runs within a Java Virtual Machine (JVM) inside a browser and offers mechanisms to tap into the JVM using custom Java code. There are a number of ways to use Java and a number of reasons that this is a compelling solution. Even if you have little or no Java language experience, you should be able to use or modify examples of Java code that are available for Forms work. In addition, Oracle's JDeveloper tool (part of the Oracle9i Developer Suite), provides a wizard and documentation to get you started developing and using Java components for Forms.

Tip: As mentioned, the white paper Oracle9i Forms in a Java World (available in the white papers section of the OTN Forms page) provides many tips and options for using Java inside of Forms.

USE PLUGGABLE JAVA COMPONENTS

Pluggable Java Components (PJCs) are JavaBeans that are either embedded in the form as a separate object (Bean Area on the Layout Editor toolbar) or that act as a substitute for a Forms object such as an item or button. Incorporating PJCs will allow you to extend the capabilities of Forms and solve problems such as how to read and write to the client's file system, how to provide a Java spell checker for a Web form, how to implement timers that fire only on the client.

Note: Oracle Technology Network contains examples of PJCs that you can use for file access and a Java spell checker (otn.oracle.com). The author's Web site mentioned that the end of the original paper contains an example of a timer that fires on the client side of a Web form and a file dialog that accesses client-side files.

IMPORT JAVA METHODS

You can create PL/SQL packages that call Java methods (code units) using the Java Importer (Program | Import Java Classes in the menu). This utility creates a package spec and body that can be used to call methods in a specific Java class (JavaBean or other type of class). This works similarly to the FFIGEN utility that is used to create PL/SQL wrappers that call functions in external libraries (such as Windows DLLs). This allows you to call pre-existing functionality that is written in Java or to call Web services. It also allows you to use Java to solve a complex programming problem that PL/SQL cannot handle. The Java Importer is available in Forms 6i release 2 and greater (9i). In addition, with Forms 9i, you can call code in JavaBeans directly without the PL/SQL package created by the Java Importer. The FBEAN built-in package (also documented in online help) contains procedures and functions that allow you to call the JavaBean's methods with or without arguments.

WHY USE JAVA?

Web-deployed Forms applications run on an application server and normally do not allow interaction with the client machine. PJCs allow you to write code that will execute within the client browser's Java Virtual Machine. This opens up many possibilities for integration with other applications, interaction with the client file system, performing functions that are processor-intensive outside of a common server, etc. In addition, Java offers a richer set of UI components than the Forms native toolkit so you can extend your form to do virtually anything. The Java components (Swing controls) are extendable and easily customizable.

Also, if there is a function that you cannot perform with a native Java component, you can write your own component (called a "JavaBean"). Naturally, you need to weigh the time to develop such components with the potential for reuse. You also need to consider potential performance issues that could arise from the extra program layers that Java may require. For example, creating a custom multi-record block component using the Java Swing JTable class and calling Business Components for Java will increase the functionality of the control (users can resize the columns in a JTable class). However, the additional layers required to implement this solution may slow down the Forms built with this control.

Incorporating Java into your form gives you a little experience with the Java language and its development environment without having to worry about Java deployment architectures. It also allows you to maintain and leverage your core competency in Forms technology and continue to use Forms for most requirements. As you use Java more and more in your forms, you may find that Java starts to provide a large part of the functionality and you may think about writing Java applications. Your experience with PJCs will help your transition into the Java world.

Note: As mentioned, PJCs can provide much of the functionality of the Windows-specific strategies such as FFI and DDE. The drawback is that you need to find (or write) a replacement for the features.

IOUG: Become a member of the IOUG to access a repository of technical content created for Oracle users by Oracle users.
 

This was last published in February 2004

Dig Deeper on Oracle Java and J2EE

PRO+

Content

Find more PRO+ content and other member only offers, here.

Start the conversation

Send me notifications when other members comment.

By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Please create a username to comment.

-ADS BY GOOGLE

SearchDataManagement

SearchBusinessAnalytics

SearchSAP

SearchSQLServer

TheServerSide.com

SearchDataCenter

SearchContentManagement

SearchFinancialApplications

Close