JavaScript (Rhino) use library or include other scripts
问题 In JDK6, is there a way to load multiple scripts, each in a file, and have the one script reference a method of another script? Sort of like "include"? 回答1: I think you're after the load() method/property of Rhino's global object/scope load("file1.js"); load("file2.js"); load("file3.js"); methodFromFileOne(); var bar = methodFromFileTwo(); var etc = dotDotDot(); This will load a javascript source file, similar to how include/require will in PHP. Once you load a file, you'll be able to call