Solved

Calling an applet from a function in a jsp page

Posted on 2004-04-12
12
675 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
Comment Utility
>>
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
Comment Utility
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
Comment Utility
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
 

Author Comment

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

Expert Comment

by:Kuldeepchaturvedi
Comment Utility
same place where other HTML tags wd be...
0
 

Author Comment

by:gdlp2004
Comment Utility
I meant do I put the applet tags inside the function, or before or after it?  Thanks
0
Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

 

Author Comment

by:gdlp2004
Comment Utility
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
Comment Utility
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
Comment Utility
You APPLET tag will also need to include the MAYSCRIPT parameter.
0
 
LVL 19

Expert Comment

by:Kuldeepchaturvedi
Comment Utility
ooops yeah, missed that one completely.... thanx Object
0
 

Author Comment

by:gdlp2004
Comment Utility
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
Comment Utility
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

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

This article explains in simple steps how to renew expiring Exchange Server Internal Transport Certificate.
In this article, I will show you HOW TO: Create your first Windows Virtual Machine on a VMware vSphere Hypervisor 6.5 (ESXi 6.5) Host Server, the Windows OS we will install is Windows Server 2016.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

728 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now