开发者

How to read HTML DOM inside the applet

开发者 https://www.devze.com 2023-02-07 16:31 出处:网络
I have embedded the signed applet in following html page, <input type=\"hidden\" name=\"xmldata\" id=\"xmldata\" value=\"\"/开发者_如何学C>

I have embedded the signed applet in following html page,

    <input type="hidden" name="xmldata" id="xmldata" value=""/开发者_如何学C>
    <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>

Following readFileApplet class read the xml file from client filesystem ,

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());
    }

}

}

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.

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

Please help me out to solve this problem.


com.sun.java.browser.dom.DOMService

See http://www.javaworld.com/javaworld/jw-06-2005/jw-0627-plugin.html?page=3

0

精彩评论

暂无评论...
验证码 换一张
取 消