0

I got a problem. I really need your solutions.

Here is the defined problem:

1/ html:

<form name="frm" action="">
    <h3>Enter some data:</h3>
    <table>
    <tr><td>Name: </td>
        <td><input type="text" name="txname" value="" size"20" /></td>
    </tr>
    <tr><td>&nbsp</td>
        <td><input type="button" name="send" value="Send" /></td>
    </tr>
    </table>
</form>
<applet name="myapplet" code="AppletParam.class" width="320" height="120">
    <param name=displayName value="sakura">
</applet>

2/ Is it possible to send data from form to applet tag? In my case I need to send from txname to applet. For example, <param name=displayName value="{txname}">.

Any ideas? please help

2 Answers 2

2
  1. Have the form do a get request for the page with the applet.
  2. Parse the the data encoded in the URL.
  3. Write the param elements for the applet containing the data in the form fields. Or alternately write the attributes of the deployment toolkit script. This might be done with:-
    • PHP
    • ASP
    • Servlet/JSP
    • Javascript & HTML
    • ..
Sign up to request clarification or add additional context in comments.

Comments

1

There are several ways to do this:

  • Create a method in your applet class say: public void setName(String name), do the needy to reflect the new name in applet.
  • Secondly in your js write code to get the applet with id, say: var myApplet = document.getElementById('myAppletId');
  • Later in js itself, invoke it on event say click or submit,etc whatever suits your scenario, myApplet.setName('new name here');

2 Comments

Excuse me!! Can you help me with simple sample? I seem to be confusing with your step. First setName(name) is in java, but myApplet.setName('newname') is in javaScript. How can we link those code?
@sakura, you are getting it right! Just try those steps and let me know.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.