Click to See Complete Forum and Search --> : embed java within javascript


gjacks
September 17th, 2004, 09:38 AM
Here is my problem.

On my jsp, I have some java code.
When I get a certain exception in java, I want to display a confirm box to the user (currently using javascript). Based on what is returned from the user I want to perform an action using java.

I am thinking the code should look something like this:

<script type="text/javascript">
<!--
var answer = confirm ("Are you having fun?")
if (answer)
***PERFORM SOME JAVA CODE***
else
***PERFORM SOME JAVA CODE***
// -->
</script>

Is something like this possible? Can someone provide me with the correct syntax?
Thanks in advance

Thingol
September 17th, 2004, 04:37 PM
You'll need to write an applet (you can choose to write a 1-pixel applet, just for using its public methods), and learn about LiveConnect in devedge.netscape.com site. (Maybe you'll need to check the "legacy" part of the site)
Although LiveConnect is a Netscape 4.X technology, it's partially implemented in Internet Explorer and it's almost fully implemented in Netscape 7 / Mozilla.