会使用java调用js文件中的函数,但是对于js中的构造函数怎么调,一脸懵逼
js文件部分内容如下:
function RSAKey() {
this.n = null;
this.e = 0;
this.d = null;
this.p = null;
this.q = null;
this.dmp1 = null;
this.dmq1 = null;
this.coeff = null
}
function b64tohex(e) {
var c = "";
//此处省略
return c
}
使用java调用b64tohex方法,我的实现:
String exponent16 = (String) inv.invokeFunction("b64tohex", new String(exponent));
但是对于无返回值的构造函数RSAKey无从下手......
直接用js调,java用js引擎执行调用
function b64tohex(e) {
var c = "1";
RSAKey();
c="2";
return c
};返回这个c,顺带判断下有没有执行RSAKey