java - Which class is equivalent to the Javascript's object window.document in GWT? -
i building extention first gets window associated httprequest explained here.
there div element in document has src external website. cancel request , associated window.
want fill window's doc string "hello world".
using following in javascript (jsni) works (ie, replaces string data external source be):
window.document.write("hello world"); but need in java rather through jsni.
i tried using class document pass object making call jsni as:
@[package].[class]::populatebox(lcom/google/gwt/dom/client/document)(window.document); the method defined as:
public static void populatebox(document doc){ doc.getbody().setinnerhtml("hello world); } this code rather replacing text @ div request loaded replaces top level body of html document.
what problem here? document wrong class use here?
there no problem code:
window.document donates th document.
doc.getbody() complete body of document.
doc.getbody().setinnerhtml(""); reomove complete content , set body new value.
i think looking appendchild:
dom.appentchild(doc.getbody(), new html('hello world!').getelement());
Comments
Post a Comment