admin管理员组文章数量:1323707
I have a html website and I am using JavaScript. I have a java Class transformation.java with a method convert(a,b) that I would like use in the javascript in my html document. How can I import the java class in my java script and use the method convert(a,b)?
Thanks.
I have a html website and I am using JavaScript. I have a java Class transformation.java with a method convert(a,b) that I would like use in the javascript in my html document. How can I import the java class in my java script and use the method convert(a,b)?
Thanks.
Share Improve this question asked Oct 15, 2010 at 8:43 HaythemHaythem 4174 gold badges13 silver badges20 bronze badges 1- 1 You would definitely need to visit this thread, What is the difference between JavaScript and Java (stackoverflow./questions/245062/… ) – Adeel Ansari Commented Oct 15, 2010 at 9:16
3 Answers
Reset to default 5Javascript != Java. You cannot import a java class in javascript. The languages are different (despite the names). You need to port the code.
Unless, you want to expose the java code as a servlet and have the javascript invoke it via an AJAX request.
- Write your self same logic in java script
- Make a server call to your java function using Javascript using DWR
You can't. :) You should check out applets. Java Applets
本文标签: javascriptimport java class in jsStack Overflow
版权声明:本文标题:javascript - import java class in js - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742128681a2422059.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论