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


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Call Java Script Function in JSP from JAVA Class" Watch "Call Java Script Function in JSP from JAVA Class" New topic
Author

Call Java Script Function in JSP from JAVA Class

Vinoy Paul
Greenhorn

Joined: Jun 16, 2011
Posts: 14
hi ,

Is there any way i can call the a javascript function from my java class.
i am using JDK 1.5 . In 1.6 i think there is a way like script engine. But i could not find out same in 1.5.

Please help
Akhilesh Trivedi
Ranch Hand

Joined: Jun 22, 2005
Posts: 1511
Javascript runs on client/browser and JSP runs on server.

BTW, what is script engine?


Keep Smiling Always — My life is smoother when running silent. -paul
[FAQs] [Certification Guides] [The Linux Documentation Project]
Vinoy Paul
Greenhorn

Joined: Jun 16, 2011
Posts: 14

I know that javascript runs on client end.

But still you can create a javascript function through java class and call it . Which can easily done in Java 1.6 through ScriptEngineManager.

Please visit the url http://www.coderanch.com/t/549722/java/java/Calling-Javascript-function-Java-Code

Akhilesh Trivedi
Ranch Hand

Joined: Jun 22, 2005
Posts: 1511
OK. Why do we use such a thing? Sometime back somebody said we use javascript for writing servers, and i was wondering how javascript is executed in such a case for i thought the only way javascript can be put to use is to be interpreted by a browser.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60046
    
  65

You cannot execute JavaScript in the browser from the server-side Java.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12675
    
    5
OK. Why do we use such a thing?


Some folks just like to use scripting languages, I guess it is an acquired taste.

As I understand it, the scripting engine that used to be the Apache Rhino project got built into Java 1.6.

Bill

Java Resources at www.wbrogden.com
 
jQuery in Action, 2nd edition
 
subject: Call Java Script Function in JSP from JAVA Class
 
Similar Threads
How to track activesession
Invoking java class from Javascript
Calling DLL function
Struts action class call from java script
invoking a java class from java script