1

我想保存网页JavaFX,我写了这段代码,这段代码只保存网页,html但我需要同一页。CSSJavaScript

SampleController sp=new SampleController();
WebEngine webEngine =sp.web.getEngine();
webEngine.load(sp.url.getText());                 
OutputStream out = new FileOutputStream(
  txtFileURL.getText() +"/"+txtname+".htm"
);
out.write(
  ((String) webEngine.executeScript(
    "document.documentElement.innerHTML"
  )).getBytes()
);
out.flush();
out.close();
4

0 回答 0