Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Call javascript from Java

 
sindhu sheela
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hai,

I want to call a javascript funtion from a java code.
Is their a way to do it?(Is their any Class to call javascript from Java).

Im working in a struts1.29 application.

Thank You
 
Ulf Dittmer
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, that's possible. Java 6 introduced the javax.scripting package for running scripts written in other languages. Java 5 and earlier can use the Apache BSF library.
 
Rob Spoor
Sheriff
Pie
Posts: 20608
63
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Check out the javax.script package.
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you want to call *client*-side JavaScript, however, the answer is no, at least not directly.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic