HOWTO: Getting an Applet to Submit InformationID: Q177161
|
When I have an applet in a <FORM> it doesn't submit any information to the server. How can I get the applet to submit its information?
The applet doesn't submit any information because the information a user would want to submit is specific to the applet. For example, an applet that shows images may want to submit the currently displayed image number, while an applet that displays a clock may want to submit the GMT time. It is up to the programmer to write the methods to submit the applet. The five steps below show one way you might implement submitting an applet.
public int getCurrentImage() {
return m_nCurrImage;
}
<form action="/scripts/info.dll" method=GET name="myForm" >
<applet code=AppletInForm.class id=myapplet width=320 height=240 >
</applet>
<input type=hidden name="appletImage">
<script language=JScript>
function processApplet()
{
parent.myForm.appletImage.value=document.myForm.myapplet.
getCurrentImage();
alert("Sending form: image="+parent.myForm.appletImage.value+"
user="+parent.myForm.Username.value);
}
</script>
<br>
Username:<input type=text name="Username"><br>
<input type=submit value="Please send me the above picture."
language="JScript" onClick="processApplet();">
</form>
For the latest Knowledge Base articles and other support information on Visual J++ and the SDK for Java,
please see the following pages on the Microsoft Technical Support site:
http://support.microsoft.com/support/visualj/
http://support.microsoft.com/support/java/
Additional query words: submit applet information
Keywords : kbcode kbnokeyword kbSDKJava300 kbVJ kbSDKJava310 kbSDKJava320
Version : WINDOWS:1.51,2.0,2.01,2.02,3.0,3.1,3.2
Platform : WINDOWS
Issue type : kbhowto
Last Reviewed: July 13, 1999