This week's book giveaway is in the Java in General forum.
We're giving away four copies of Think Java: How to Think Like a Computer Scientist and have Allen B. Downey & Chris Mayfield on-line!
See this thread for details.
Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Calling Javascript function from Java Code

 
Tarun Kumar Agrawal
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?
 
Vijay Tidake
Ranch Hand
Posts: 148
Hibernate Java Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

please check this link

Thanks
 
Darryl Burke
Bartender
Posts: 5126
11
Java Netbeans IDE Opera
  • 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?
 
Jesper de Jong
Java Cowboy
Saloon Keeper
Posts: 15277
38
Android IntelliJ IDE Java Scala Spring
  • 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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic