File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes Calling Javascript function from Java Code Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Calling Javascript function from Java Code" Watch "Calling Javascript function from Java Code" New topic
Author

Calling Javascript function from Java Code

Tarun Kumar Agrawal
Greenhorn

Joined: Jun 29, 2011
Posts: 17
Hi,

I want to call Javascript function from Java Code (not Java Applet). How can i do that?
Vijay Tidake
Ranch Hand

Joined: Nov 04, 2008
Posts: 146

Hi,

please check this link

Thanks


The important thing is not to stop questioning.Curiosity has its own reason for existing.
Darryl Burke
Bartender

Joined: May 03, 2008
Posts: 4642
    
    5

Here's another link.

luck, db
There are no new questions, but there may be new answers.
Tarun Kumar Agrawal
Greenhorn

Joined: Jun 29, 2011
Posts: 17
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

Joined: Aug 16, 2005
Posts: 14268
    
  21

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.


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 8 API documentation
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Calling Javascript function from Java Code