Thursday, June 17, 2010

Using Applet in OAF

I have came across the use of applet within OAF page for a requirement where I had to use Java APIs provided by an activeX control loaded on client machine. Since OAF code runs on server side and not on client machine, using the applet was the only option to use.

The steps for using the applet are

  • Suppose XXApplet.class is the class file of your applet. First step is to package the applet into a jar file and sign the jar file. A page allow only singed applets to run, hence signing the applet is required.
  • To convert an applet class to a jar, command is

jar cvf uXXApplet.jar XXApplet.class

  • To sign the above jar file, follow below two links in chronological order by logging into unix server

http://java.sun.com/docs/books/tutorial/security/toolfilex/step2.html

http://java.sun.com/docs/books/tutorial/security/toolfilex/step3.html

  • On your OAF page, create OARawTextBean item. Lets assume its ID is xxApplet.
  • Extend the controller of the page. In your process request, you can attach the html text to the above Raw Text Bean as below. The example also shows passing the parameters to applet as "DocumentName" and "DocumentId".

String appletCode = "{applet code='XXApplet.class' ARCHIVE='XXApplet.jar' width=550 height=75}" + "{PARAM NAME='DocumentName' VALUE='XXXXXXX'}" + "{PARAM NAME='DocumentId' VALUE='A5577'}" +"This browser does not support Applets.{/applet}"; // replace } with > and { with <

OARawTextBean appletBean = (OARawTextBean)webBean.findChildRecursive("xxApplet"); !

appletBean.setText(appletCode);

  • Put the signed Applet jar file at $OA_HTML.


3 comments:

lakshmi said...

Hi gowrishankar,

I have submit button in a oaf page which invokes the applet.I have one issue in this page .here i have 2 pages first oaf page and 2nd page is applet. first navigating from oaf to applet working properly.but when navigating from applet page to oaf page by clicking on back button in applet navigating to oaf search page.but after this when i navigate to applet this time iam not geting some tool tips and some options. can u please do needful.
is this sum thing with seesion values

oraclefusion said...

Thanks for sharing for the further information about the oracle visit
Oracle Fusion Financials Training

for IT the said...

Hi, Great.. Tutorial is just awesome..It is really helpful for a newbie like me.. I am a regular follower of your blog. Really very informative post you shared here. Kindly keep blogging. If anyone wants to become a Java developer learn from Java Training in Chennai. or learn thru Java Online Training in India . Nowadays Java has tons of job opportunities on various vertical industry.


or Javascript Training in Chennai. Nowadays JavaScript has tons of job opportunities on various vertical industry.