I have a Javascript function in my xhtml page that does the following:
HTML FILE:
function getData(){
var data = document.getElementById('data');
return data;
}
<input type="hidden" value="#{bean.bytes}"/>
Backing Bean Code:
public class Bean{
public byte[] getBytes(){
return this.bytes;
}
}
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",开发者_StackOverflow社区 null);
}
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;
}
But that will only return me the String representation of the byte[], not the actual object.
So my question is: How do I use JSObject to get a JavaObject?
Current method gets me back a String
There is no data
property.
Change it to returnedValue.getMember("value")
.
精彩评论