Sample of submit information from Applet to Servlet/JSP. Hope it helps.
J.H
1.Create an applet with a public function that returns the information you want to submit. (For the first example above, you would return the image number.)
public int getCurrentImage() {
return m_nCurrImage;
}
2.Create a Web page with an applet inside your form.
3.Create a hidden field in the <FORM>, where your applet will submit its data.
Write a script function, like processApplet() in the example below, to populate the hidden field by calling public functions of your applet.
Set your submit button's onClick function to call the script function you wrote in step 4.
Here is the finished product:
<form action="/scripts/info.jsp" 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="JavaScript" >
</form>
-----Original Message-----
From: Rick L Sample [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, December 08, 1999 3:09 PM
To: [EMAIL PROTECTED]
Subject: "Submit" to a Servlet - How?
I have a servlet called authenticate and want to submit to it from a .jsp.
I know the forward command works, but is that the only way?
Don't work...
<form method=GET action=authenticate>
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
FAQs on JSP can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html
