Solved

Calling an applet from a function in a jsp page

Posted on 2004-04-12
12
678 Views
Last Modified: 2008-03-10
I have a jsp page that has dropdown boxes, that uses an onChange command to respond to any changes in the selection of any dropdown.  Based upon this, a query in a javascript function will run that will logically locate the children of the dropdown selection and dynamically populate them into the next dropdown box.  The query finds its children, then will send the recordset values to an applet that will change the state attribute of each option to true instead of false.

My question is this...writing the applet shouldn't be a problem, but how do you call it from the function once you create it?  Also, do you embed the applet onto the jsp page, or keep it as a separate file and link it to the same jsp package?  Thanks.
0
Comment
Question by:gdlp2004
  • 6
  • 5
12 Comments
 
LVL 19

Expert Comment

by:Kuldeepchaturvedi
ID: 10807296
>>
My question is this...writing the applet shouldn't be a problem, but how do you call it from the function once you create it?  Also, do you embed the applet onto the jsp page, or keep it as a separate file and link it to the same jsp package?  Thanks.

you can call it from a java script function just like any other object on the HTML

<APPLET NAME='screenCapture' Code='ScreenCaptureApplet'  CODEBASE='../classes' width=100 height=100></APPLET>

and in the java script

document.screenCapture.captureImage(00,100,100,100,imgdescription);
                   
here captureImage is a method written inside the Applet..

>>do you embed the applet onto the jsp page
Yes you embed it as I have written above ( you do not embed the actual code here but the reference of the applet class file)
0
 

Author Comment

by:gdlp2004
ID: 10807333
what does the imgdescription mean?  Are the #'s before it size values?  Also, where in the javascript do you place the screenCapture line of code?  Does anything go in between the applet tags?  Thanks again
0
 
LVL 19

Expert Comment

by:Kuldeepchaturvedi
ID: 10807538
imagedescription is one of the parameter that is being passed.
yes those numbers are size values... in essence they the paramters being passed to the method named captureImage which is written inside applet.
this call to capture image can go in to your onchange function that you have written on the change of the drop down
0
Active Directory Webinar

We all know we need to protect and secure our privileges, but where to start? Join Experts Exchange and ManageEngine on Tuesday, April 11, 2017 10:00 AM PDT to learn how to track and secure privileged users in Active Directory.

 

Author Comment

by:gdlp2004
ID: 10807994
Where do the applet tags go into the JSP page?
0
 
LVL 19

Expert Comment

by:Kuldeepchaturvedi
ID: 10808021
same place where other HTML tags wd be...
0
 

Author Comment

by:gdlp2004
ID: 10808087
I meant do I put the applet tags inside the function, or before or after it?  Thanks
0
 

Author Comment

by:gdlp2004
ID: 10808160
Please bare with me...I'm not a genius at this stuff. ;)

Say this is my function...

 <Script language="JavaScript">
 function Linkup()
  {

}


Could you write out what needs to be put in there to call an applet called test.java?  Thanks!
0
 
LVL 19

Accepted Solution

by:
Kuldeepchaturvedi earned 400 total points
ID: 10808411
your generated HTML should have a tag inside the BODY tag which will look like...

<APPLET NAME='test' Code='test'  CODEBASE='/classes' width=100 height=100></APPLET>


your script will look like

<Script language="JavaScript">
 function Linkup()
 {
document.test.functionname(function params);
}

and test.class should reside inside a folder named classes in your web application...

which most probably will be inside the webapps directory of your tomcat....:-)


>>>Please bare with me...I'm not a genius at this stuff. ;)
Don't worry no body is....
0
 
LVL 92

Expert Comment

by:objects
ID: 10809304
You APPLET tag will also need to include the MAYSCRIPT parameter.
0
 
LVL 19

Expert Comment

by:Kuldeepchaturvedi
ID: 10809309
ooops yeah, missed that one completely.... thanx Object
0
 

Author Comment

by:gdlp2004
ID: 10813149
Thanks guys, I really appreciate your help.  Btw, what is the mayscript parameter and what does it do?
0
 
LVL 19

Expert Comment

by:Kuldeepchaturvedi
ID: 10813182
Its a tag ( If I remember correctly its netscape directive which allows the script-Applet communication...

<APPLET NAME='test' Code='test'  CODEBASE='/classes' width=100 height=100 MAYSCRIPT></APPLET>

thats how you write it...
 
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
method inner class 6 83
default methods vs abstract class 1 118
Prevent Firefox page from going to the background when clicking a spreadsheet link 17 70
print map entry 34 72
If you are looking at this article, you have most likely been hit by some version of ransomware and are trying to find out if there is anything you can do, or what way you should react - READ ON!
Ransomware continues to grow in reach and sophistication, putting data everywhere at risk. Learn how to avoid being caught in its sinister clutches with these 11 key tips.
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question