wood burning stoves*
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
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: 1526
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: 1526
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: 60782
    
  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: 12761
    
    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
 
Consider Paul's rocket mass heater.
 
subject: Call Java Script Function in JSP from JAVA Class
 
Similar Threads
Struts action class call from java script
How to track activesession
invoking a java class from java script
Invoking java class from Javascript
Calling DLL function