获得一个JAVAOBJECT了JSObject的 [英] Getting a JavaObject out of a JSObject
问题描述
我在我的XHTML页面的JavaScript函数执行以下操作:
I have a Javascript function in my xhtml page that does the following:
HTML文件:
function getData(){
var data = document.getElementById('data');
return data;
}
<input type="hidden" value="#{bean.bytes}"/>
辅助Bean code:
Backing Bean Code:
public class Bean{
public byte[] getBytes(){
return this.bytes;
}
}
和我有一个需要从HTML获取此字节数组的applet
小程序code:
And I have an applet that needs to get this byte array from the html Applet code:
public class TestApplet extends Applet{
JSObject win = JSObject.getWindow(this);
JSObject returnedValue = win.call("getData", null);
}
我一直在试图调用returnedValue.getMember(值)的(固定)的;但是,获取一个空值。
我也试图改变javascript来这样的:
I've been trying to call the returnedValue.getMember("value") (fixed); but that gets a null value. I also tried to change the javascript to this:
HTML
function getData(){
var data = document.getElementById('data').value;
return data;
}
但是,这只会返回我的字节的字符串重新presentation [],而不是实际的对象。
But that will only return me the String representation of the byte[], not the actual object.
所以我的问题是:
如何使用JSObject获得JAVAOBJECT?
的当前方法获取我回一个String 的
推荐答案
有没有数据
属性。结果
将其更改为 returnedValue.getMember(值)
。
这篇关于获得一个JAVAOBJECT了JSObject的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!