package de
import javax
import javax
import javax
import java
public class AjavaAccessJavaObjectFromScript {
public static void main(String[] args) {
//創建用戶數組
String[] users = {
Date now = new Date()
//腳本代碼
String script =
//獲得JS腳本引擎
ScriptEngineManager manager = new ScriptEngineManager()
ScriptEngine engine = manager
//設置JS腳本中的userArray
engine
engine
try {
engine
} catch (ScriptException e) {
e
}
}
}
運行結果
mark
道長
笨笨
way
在線用戶 (Tue Apr
From:http://tw.wingwit.com/Article/program/Java/hx/201311/26879.html