Java Applet using getSelectedDocuments() using MS and Sun JVMs

 

Solution: Java Applet using getSelectedDocuments() using MS and Sun JVMs

Posted by Jeffery Sorensen on 5.Oct.03 at 上午 11:25 using a Web browser

Category: Applications Development

Release: All Releases

Platform: All Platforms

I discovered a solution to being able to use the Java getSelectedDocuments() function using both IE and MS and Sun JVMs. This Java method reports which documents the user has selected in the Java View applet and is useful for web applications which use the Domino Java View applet.

When using Internet Explorer, most people use the getSelectedDocumentsEx() function, since it returns a Vector object. Internet Explorer (even at version 6) has a problem processing Java Arrays of Strings. Netscape is fine with it, however.

If using the Microsoft JVM, the getSelectedDocumentsEx() works fine. However, since the court case with Sun, Microsoft are refusing to ship or redirect to Microsoft's JVM going forward. All new versions of Windows XP do not come with Java and will not download Microsoft's VM any more.

This presents a problem. The only Sun JVM I have found to work with Domino is version 1.4.0_03 (which ships with Netscape 7.02 incidentally). Even if you get this version downloaded, the getSelectedDocumentsEx() function does not work using a Sun JVM on a Windows PC. You must use the getSelectedDocument() function, but as mentioned, Internet Explorer does not understand Java String Arrays, so it's catch 22.

I have discovered a workaround that allows you to use either the Microsoft JVM or the Sun JVM on a Windows PC and have the code work on Netscape as well.

Here it is. I'm sure the Javascript code could be improved, I would welcome any suggestions:

// code start

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]);

}

// code end

Based on the number of entries this issue has created, I figured there would be interest in posting this solution. Hope you find it useful.

Cheers

 

源文档 <http://www-10.lotus.com/ldd/nd6forum.nsf/DateAllThreadedweb/3a06549596dc1c6d85256db60054b53d?OpenDocument>

 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值