• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Rob Spoor
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Junilu Lacar
  • Tim Cooke
Saloon Keepers:
  • Tim Holloway
  • Piet Souris
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Frits Walraven
  • Himai Minh

Accessing JavaMethod from javascript

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is there a way to Accessing JavaMethod from Javascript on a jsp page

<body onunload="doUnload()">

function doUnload()
{
alert("Window is closed...!");
Class1.ClearObject();

}


I am able to get the alert but am not able to access the ClearObject method inside static class Class1

Any help/hint is appreciated
 
Sheriff
Posts: 67581
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"tripod tech", please check your private messages for an important matter.
 
Bear Bibeault
Sheriff
Posts: 67581
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
No. That's what you need Ajax for.
 
Rahul Sinha
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Bear Bibeault:
No. That's what you need Ajax for.




Can you guide me through the process
 
Rancher
Posts: 43026
76
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Should this Java method run on the server or on the client? If the former, AJAX is -as Bear mentioned- your best bet. If the latter, you could embed an applet in the page that runs the method for you. That'd be a hack, though, with a number of drawbacks.
 
Rahul Sinha
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Ulf Dittmer:
Should this Java method run on the server or on the client?



It would be running on the client but there's no applet used..could you guide me on the steps using ajax to make the java call
 
Bear Bibeault
Sheriff
Posts: 67581
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ajax would be used to communicate back to the server. If the Java code is to run on the client, you'll need to use an applet.
 
Where all the women are strong, all the men are good looking and all the tiny ads are above average:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic