如何阅读HTML DOM的applet中 [英] How to read HTML DOM inside the applet

查看:103
本文介绍了如何阅读HTML DOM的applet中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在下面的html页面嵌入签名Applet,

I have embedded the signed applet in following html page,

    <input type="hidden" name="xmldata" id="xmldata" value=""/>
    <APPLET CODE="com.syntel.upload.readFileApplet.class" ARCHIVE="sign-upload.jar" HEIGHT="200" WIDTH="475" ALIGN="bottom">
      This browser does not appear to support Applets.
    </APPLET>

继readFileApplet类读取从客户文件系统中的XML文件,
结果

Following readFileApplet class read the xml file from client filesystem ,

公共类readFileApplet扩展的Applet {

public class readFileApplet extends Applet {

StringBuffer strBuff;

public void init() {
    add(txtArea, "center");
    readFile();
    String xmldata = strBuff.toString();

    //TODO: set the xmldata string to html hidden variable
}

public void readFile() {
    String line;

    try {
        InputStream in = new FileInputStream("c:\\ftlmb\\finstmt.xml");
        BufferedReader bf = new BufferedReader(new InputStreamReader(in));
        strBuff = new StringBuffer();
        while ((line = bf.readLine()) != null) {
            strBuff.append(line + "\n");
        }
    } catch (IOException e) {
        txtArea.append(e.getMessage());
    }

}

}

我能够读取使用的小程序,但无法设置XMLDATA字符串隐变量XMLDATA,这是在HTML页面的XML。

I am able to read the xml using applet but unable to set the xmldata string to hidden variable "xmldata" which is in html page.

有,我可以用它来获得DOM,这样我可以将值设置为隐藏变量的API。

Is there any API which i can use to get the DOM so that i can set the value to hidden variable.

请帮我解决这个问题。

推荐答案

com.sun.java.browser.dom.DOMService

com.sun.java.browser.dom.DOMService

请参阅 HTTP:// WWW .javaworld.com /和javaworld / JW-06-2005 / JW-0627-plugin.html?页= 3

这篇关于如何阅读HTML DOM的applet中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆