Javascript to Java Applet communication -
I am trying to pass a selected value from the HTML drop-down with an applet method using the setter method in the applet I am But every time Javascript applies, it shows that as an exception, "objects do not support this property or method".
My Javascript code:
function show selected (value) {warning (+ value given from "value"); Var diseasename = value; Warning (diseasename); Document.decisiontreeapplet.setDieasename (diseasename); Warning ("I'm after value set"); } My applet code:
package com. Facility; Import java.io.phileNotFoundException; Import java.io.IOException; Import java.io.InputStream; Import java.net.MalformedURLException; Import java.net.URL; Import java.net.URLConnection; Import prefuse.util.ui.JPrefuseApplet; Public Square DynamicTreeApplet, JPrefuseApplet {Personal Stable Last Long Serial VersionUID = 1L; Public static int i = 1; Public string डायसनामनामको code; //System.out.println("asjdjkhcd"+dieasenameencode); Public Zero Init () {System.out.println ("asjdjkhcd" + Dysonamine code); System.out.println ("I value" + i); Url = null; // string ashu = this.getParameter ("dieasenmae"); //System.out.println (die die is "+ ashu); // Here the dieasesname page is important for refreshing // string dencode = dieasenameencode.trim (); try {// string dinosample = url encoder.x code (DNcode, "UTF-8"); // I want this piece of code called url = new URL ("http: // localhost: 8080 / docRuleToolProtocol / appletRefreshAction.do? Dieasename =" + dieasenameencode; URLConnection Con = url.openConnection (); con.setDoOutput (right); con.setDoInput (right); con.setUseCaches (wrong); InputStream OIS = con.getInputStream (); This.setContentPane (dynamicView.demo ("OIS," name ")); Ois.close ();} catches Larmdural lexception e) {e.printStackTrace ();} hold (FileNotFoundException f) {f.printStackTrace ();} grip (IOException io) {io.printStackTrace ();} ++ i;} Public Zero SetDesigner name (string message) { System.out.println ("At least I am here and called"); this.dieasenameencode = message; System.out.println ("the last value of dinosation" + dianeincode); }} My appletdeployment code:
& gt; Applet id = "decisiontreeapplet" code = "com.vaannila.utility.dynamicTreeApplet.class" store = "./appletjars/dynamictree.jar, ./appletjars/prefuse.jar" width = "1000" height = "500" & gt; ; & Lt; / Applet & gt;
.
document.decisiontreeapplet < / Code> .. from ..
document.getElementById ('decisiontreeapplet') .. and this is the most Will likely work
Easy HTML & lt; Html & gt; & Lt; Body & gt; & Lt; Script type = 'text / javascript' & gt; Function callApplet () {msg = document.getElementById ('Input'). Values; Applet = document.getElementById ('output'); Applet.setMessage (MSG); } & Lt; / Script & gt; & Lt; Input id = 'input' type = 'text' size = 20 onchange = 'callApplet ()' & gt; & Lt; Br> & Lt; Applet id = 'output' code = 'callplatform' width = 120 height = 20> & Lt; / Applet & gt; & Lt; / Body & gt; & Lt; / Html & gt; java import javax.swing. *; Public class call applet JApplet {JTextField extends into output; Public zero init () {output = new JTextField (20); (Production); Valid (); } Public Zero Set Message (String Message) {output.setText (Message); }}
Please consider posting a short full example next time. Note that the number of the above two sources shown above is low, which is your example Applet, and it took me so much time to prepare the source so that I could see my answer.
Comments
Post a Comment