Solved

applet to jsp

Posted on 2004-04-03
22
1,422 Views
Last Modified: 2008-02-01
Hi Experts,

I have applet running within my jsp. I pass some param.

<param name="CustID" value="1">      

How can I retrieve this param CustID back from APPLET ?

Thank you.
0
Comment
Question by:fpoyavo
  • 11
  • 7
  • 4
22 Comments
 
LVL 92

Expert Comment

by:objects
Comment Utility
you can use js to call the applet to return the parameter but why would u need to as the jsp page already has the value?
0
 
LVL 1

Author Comment

by:fpoyavo
Comment Utility
The problem is that this applet when it is used by the user may modify this CustID ...so I need to know the new one.

How exactly I can do that ?
0
 
LVL 92

Expert Comment

by:objects
Comment Utility
Add a public method to your applet to return the custid, and call the applet from js to retrieve it.
0
 
LVL 1

Author Comment

by:fpoyavo
Comment Utility
Objects,

You are the best. May you give me some simple code sample ?

Thank you.
0
 
LVL 1

Author Comment

by:fpoyavo
Comment Utility
I need to get this CustID whenever user clicks within applet area.
0
 
LVL 92

Expert Comment

by:objects
Comment Utility
> I need to get this CustID whenever user clicks within applet area.

for what purpose?  what do u need to do with the value
0
 
LVL 1

Author Comment

by:fpoyavo
Comment Utility
I need it to process another jsp.

Please.
0
 
LVL 92

Expert Comment

by:objects
Comment Utility
But why do you need it everytime user clicks within applet?
0
 
LVL 1

Author Comment

by:fpoyavo
Comment Utility
:) objects. just help me and don't ask me why.
0
 
LVL 92

Expert Comment

by:objects
Comment Utility
Was just asking because it may affect the way you achieve it :)

You should either call the applet using javascript,
or have the applet call a javascript function.
Whichever is most appropriate in your situation.
0
 
LVL 1

Author Comment

by:fpoyavo
Comment Utility
I was trying to do that:

like you adviced :

in my javascript which I have tried to run directly and from .js
function getnewid()
{
var newid = document.myApplet.appletmethod();
alert ("here it is : " + newid);
}

it is in <img src="mybutton.gif" onclick="getnewid();">

when I click nothing is happening...no errors no nothing. I have inserted MAYSCRIPT in the CODE line but nothing is going on.

Hmmmm. ??? Please .
0
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 1

Author Comment

by:fpoyavo
Comment Utility
It actually give a warning in line where my <img>  that object is expected when I click on image.
0
 
LVL 1

Author Comment

by:fpoyavo
Comment Utility
I have puted just alert("javascript is started") in onclick event and it does not show up. What the .... is this ?
0
 
LVL 92

Expert Comment

by:objects
Comment Utility
Perhaps img tag does not support onclick, test with:

function getnewid()
{
alert ("Here");
}
0
 
LVL 1

Author Comment

by:fpoyavo
Comment Utility
Ok. I see you trying to drive me crazy :) bye. Wish you luck. IMG always supported onclick and I hope you are kidding :)

PLEASE CLOSE THIS QUESTION.
0
 
LVL 92

Expert Comment

by:objects
Comment Utility
if you use the function I posted above does the alert() get displayed?
0
 
LVL 1

Author Comment

by:fpoyavo
Comment Utility
Objects :),

I told you that I was trying it and there is no alert.
May be it has to do with JSP ?

forget about it.
0
 
LVL 14

Expert Comment

by:kennethxu
Comment Utility
try to change you name of applet form myApplet to myapplet (all lowercase). or use document.applets[0]
make sure the method name must be exactly the same as you defined in applet, case sensitive.

http://www.apl.jhu.edu/~hall/java/Java-from-JavaScript.html
http://www.apl.jhu.edu/~hall/CWP-Sources/CWP-Examples/Chapter19/MoldSimulation.html (view source)
0
 
LVL 14

Accepted Solution

by:
kennethxu earned 500 total points
Comment Utility
0
 
LVL 14

Expert Comment

by:kennethxu
Comment Utility
0
 
LVL 1

Author Comment

by:fpoyavo
Comment Utility
Thanks a lot. Great sample.
0
 
LVL 14

Expert Comment

by:kennethxu
Comment Utility
glad to know and my pleasure :-)
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.
A safe way to clean winsxs folder from your windows server 2008 R2 editions
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

771 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