Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Calling an applet from a function in a jsp page

Posted on 2004-04-12
12
Medium Priority
?
685 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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 1600 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

Ask an Anonymous Question!

Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.

Question has a verified solution.

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

Microsoft Access has a limit of 255 columns in a single table; SQL Server allows tables with over 255 columns, but reading that data is not necessarily simple.  The final solution for this task involved creating a custom text parser and then reading…
Hello there! As a developer I have modified and refactored the unit tests which was written by fellow developers in the past. On the course, I have gone through various misconceptions and technical challenges when it comes to implementation. I would…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
Screencast - Getting to Know the Pipeline

972 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