Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Calling an applet from a function in a jsp page

Posted on 2004-04-12
12
Medium Priority
?
683 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Industry Leaders: 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

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

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

Instead of error trapping or hard-coding for non-updateable fields when using QODBC, let VBA automatically disable them when forms open. This way, users can view but not change the data. Part 1 explained how to use schema tables to do this. Part 2 h…
Are you an Exchange administrator employed with an organization? And, have you encountered a corrupt Exchange database due to which you are not able to open its EDB file. This article will explain all the steps to repair corrupt Exchange database.
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…

715 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