How to call javascript from java code -
i have no thought how , found examples of how phone call creating script in java code (what don't want), in asp.net utilize code scriptmanager.registerstartupscript(this.page, page.gettype(), "info only", "alert('" + message + "');", true);
phone call script + pass parameters , work fine wished. have no thought of how in java. give thanks you
simply googling found link provides examples on how invoke javascript file.
here simple illustration going:
import java.io.*; import javax.script.*; public class app { public static void main(string[] args) { string file = "javascript.js"; seek { scriptengine engine = new scriptenginemanager().getenginebyname("javascript"); filereader fr = new filereader(file); engine.eval(fr); } catch(ioexception ioex) { ioex.printstacktrace(); } catch(scriptexception screx) { screx.printstacktrace(); } } }
java javascript
No comments:
Post a Comment