Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

pass parameter from text box to applet

 
Rohit Agarwal
Greenhorn
Posts: 9
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Gurus,
I need a help. In my requirement i have an applet to which i need to pass a parameter from the html page that it is embedded into.
Eg: say i have a text box in the html page in which the user enters a string. I need to pass this string (textbox value) into the applet as a parameter. How do i do that?
Basically it is applet - html communication.
Thanx in advance
Rohit
 
Alan Watts
Greenhorn
Posts: 28
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Rohit,
You can do this with javascript I suppose, but have you considered doing it a slightly differently? Using a TextField in the applet you can read the value entered into the TextField as a String and then parse it if neccessary:
TextField Textfield;
String line = Textfield.getText();

Cheers
Alan
 
Rohit Agarwal
Greenhorn
Posts: 9
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Alan,
I know how to get the data from the Textfield object of an applet. What i want to know is that say if i have an applet which does not have an graphic content and i need to pass a value from an HTML text box to the applet. How can we do it.
Rohit
 
Karen Parker
Greenhorn
Posts: 15
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You should be able to use the applet param tags to do this.
eg.

Then, in your applet class code, use getParameter to get the value of the string:

Now the only problem is getting the information from the HTML text field and putting it into the parameter tag. Perhaps you could use Javascript? Maybe someone else can suggest a solution to this part...
[This message has been edited by Karen Parker (edited July 23, 2001).]
 
Rohit Agarwal
Greenhorn
Posts: 9
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Karen,
You are right, using the param tag i can pass values to Applet. As you pointed out the problem now is how to pass that value as a string to the value attribute of the param tag.
Can somebody throw some light on this. would appreciate it.
Rohit
Originally posted by Karen Parker:
[B]You should be able to use the applet param tags to do this.
eg.

Then, in your applet class code, use getParameter to get the value of the string:

Now the only problem is getting the information from the HTML text field and putting it into the parameter tag. Perhaps you could use Javascript? Maybe someone else can suggest a solution to this part...
[This message has been edited by Karen Parker (edited July 23, 2001).][/B]

 
Don't get me started about those stupid light bulbs.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic