call html file from applet and return data to applet.

I need to get any data from user via html file .How can I call html file from a applet and after user pick any button return data to the applet .Help me ,please .
[184 byte] By [viky] at [2007-9-30 22:12:22]
# 1

Your question is a little vague, but if you are saying that you want the user to enter data onto a regular HTML form and then have the data processed by an applet, the easiest way would be to have the form call a JavaScript function (by adding a onClick, onChange, or onSubmit attribute) and then have the JavaScript call a function on the applet.

Depending on your browser, you may need the "MAYSCRIPT" attribute on the <appplet> tag.

Michael_Lorton at 2007-7-7 11:25:28 > top of Java-index,Java Essentials,Java Programming...
# 2

Thank you for you response .

But the problem is a bit different. The start point is a loaded java applet. Then it calls an html form, the user fills it and push on submit. On this point I want the same already loaded applet to get the information filled in the html form.

How in an html (which not originally loaded the applet) I can call a function of an already loaded applet?

The initiator html (which loads the java applet) recognize the applet by document.applets array. But the 2nd html we load from the Java applet doesn't know this array.

The question is how this second html can then call to a function in the applet that invoked it?

viky at 2007-7-7 11:25:28 > top of Java-index,Java Essentials,Java Programming...
# 3

> The start point is

> a loaded java applet. Then it calls an html form,

The applet "calls" a form. What do you mean?

> The initiator html (which loads the java applet)

> recognize the applet by document.applets array. But

> the 2nd html we load from the Java applet doesn't know

> this array.

Yeah, you cannot really go from one document to another -- for obvious security reasons. What is it you are trying to?

Michael_Lorton at 2007-7-7 11:25:28 > top of Java-index,Java Essentials,Java Programming...
# 4

The target is when the applet is running to display to the user an html, we expect the user to fill in the html fields and press submit when done. Then I want to get the fields values back to the applet.

We use it to display a customized "job ticket" to the user, and it is much more easier to do the customization with this html approach.

This is the way I call the html from the java applet.

url is the path to the html to display

String WIN_ID = "Windows";

// The default system browser under windows.

String WIN_PATH = "rundll32";

// The flag to display a url.

String WIN_FLAG = "url.dll,FileProtocolHandler";

cmd = WIN_PATH + " " + WIN_FLAG + " " + url;

Process p = Runtime.getRuntime().exec(cmd);

Thanks

viky at 2007-7-7 11:25:28 > top of Java-index,Java Essentials,Java Programming...