• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Calling Javascript function from Java Code

 
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I want to call Javascript function from Java Code (not Java Applet). How can i do that?
 
Ranch Hand
Posts: 148
Hibernate Tomcat Server Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

please check this link

Thanks
 
Bartender
Posts: 5167
11
Netbeans IDE Opera Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here's another link.
 
Tarun Kumar Agrawal
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In this code,



If i change script (replace print by alert), it shows error. I want to show an alert message, how should i do it?
 
Java Cowboy
Posts: 16084
88
Android Scala IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you're trying to do this because you want to display a message box on the client's computer from a servlet, as in your previous topic, then this is not going to work.

You have to be aware that the servlet runs on the server, not on the client computer. If you use the scripting API to run JavaScript code from your servlet, then it's going to run on the server, and not the client. If your goal is to display a message box on the client's computer, then trying to run JavaScript code on the server doesn't make sense.
 
Consider Paul's rocket mass heater.
    Bookmark Topic Watch Topic
  • New Topic