Solved

Calling an applet from a function in a jsp page

Posted on 2004-04-12
12
677 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
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 

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

Does Powershell have you tied up in knots?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Question has a verified solution.

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

In this article we will learn how to backup a VMware farm using Nakivo Backup & Replication. In this tutorial we will install the software on a Windows 2012 R2 Server.
This article outlines the process to identify and resolve account lockout in an Active Directory environment.
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
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…

777 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