Java in Lotus Notes

I’m trying to use Java applets in Domino’s forms and pages. But I don’t understnd if it’s possible to open a document from Java applet (like Edit method in NotesUIWorkspace) and if it possible to establish an information exchange between Java and Lotus Script or Java Script. Maybe someone can help me ?

Subject: Java Applet Access with JavaScript

You can access a Java Applet that is embedded in a Web page by using JavaScript. You would access it the same way you would access a COM/ActiveX object, such as a Macromedia Flash.

An example would be to get the row a User selected in the NotesView Java Applet. Such as:

// JavaScript on a Web page using the NotesView Java Applet

var viewApplet = document.applets.view;

var docs = viewApplet.getSelectedDocuments();

if (navigator.appName == ‘Microsoft Internet Explorer’) {

var cbb = new VBArray(docs);

var docs = cbb.toArray();

}

var i;

for (i = 0; i < docs.length; i++) {

alert("i(" + i + ")=" + docs[i]);

}

On our ValidX Contracts System (www.validxtek.com), I often used a popup window containing the Java View applet. When the User selected the document(s), and clicked on the OK button (as opposed to Cancel button), I then used the getSelectedDocuments() to get the UNID’s of the selected documents, stored those values in a hidden input field, and submitted the form.

The form’s WebQuerySave called a NotesAgent in LotusScript that took the UNID’s out of the input field, opened each document, extracted the desired data, constructed a very simple web page that posted the data to the parent window and closed, all via a simple “print” command.

Unfortunately, there are no View Applet API functions to extract the contents of the View, other than the UNID’s. Such a function would, of course, remove the need to go back to the Server to extract the needed information.

Subject: RE: Java Applet Access with JavaScript

Thank you for your help. I’ve got some additional quetions … So I have an applet on the domino’s form and I insert a JavaScript on form to use it with some data from applet.

var viewApplet = document.applets.view;

 - so view is an applet name ?

var docs = viewApplet.getSelectedDocuments();

 /* - as I understand I can call any function declared in Applet public class ? */

if (navigator.appName == ‘Microsoft Internet Explorer’) {

var cbb = new VBArray(docs);

var docs = cbb.toArray();

/* - here we convert from NotesDataCollection to JavaScript array ? */

}

var i;

for (i = 0; i < docs.length; i++) {

alert(“i(” + i + “)=” + docs[i]);

}

And is it possible to receive messages from applet ?