How do you write back to a document from a Java applet?

I have embedded a Java applet on a form, and it launches when I open a document using the form. I can use the applet to do what I need to do, but now I need to write back data from the applet to the document. None of the methods I’m trying work:

doc.ReplaceItemValue(“field”, String) - crashes the client consistently

doc.ReplaceItemValue(“field”, “some text”) - doesn’t work at all

Has anyone done this successfully? It seems like it should be fairly easy, considering the applet is sitting on the document, and I can get the document object easily using the NotesAppletContext.

Thanks!

Subject: use the Java to JavaSript bridge

You need to call out to JavaScript to access the underlying document; see the documentation on netscape.javascript.JSObject. Here’s a good start: Oracle Java Technologies | Oracle