0
我在文本區域中輸入Java代碼:
package com.test.webapp.controller;
import org.activiti.engine.impl.persistence.entity
import com.test.webapp.controller;
import java.util.HashMap;
HashMap message = new HashMap();
message.put("table","TEST");
message.put("ID","1236");
message.put("NAME","Three");
message.put("AREA","chennai");
JavaTest javaTest = new JavaTest();
javaTest.saveMessage(message);
我收到上述代碼串爲「javaEvent 「在Java代碼在我的Java控制器
public @ResponseBody void executeJavaCode(@RequestParam("javaEvent") String javaEvent) {
Interpreter interpreter = new Interpreter();
interpreter.eval(javaEvent);
}
public void saveMessage(Map<String, String> tableDetails) {
System.out.println("===============mess============="+message.size());
}
saveMessage方法被執行很好.. 但調用saveMessage任何服務方法拋出空指針異常。服務不在這裏注入.. 如何在bean腳本中調用服務方法?
例如:(這樣我需要)
public void saveMessage(Map<String, String> tableDetails) {
System.out.println("===============mess============="+message.size());
testService.someMethod(tableDetails);
}
感謝您的回覆.. javaTest的實例正在調用saveMessage方法..但我無法在saveMessage方法中使用任何服務。例如,我想將地圖細節傳遞給其他服務,如public void saveMessage(Map tableDetails){System.out.println(「===============亂七八糟=============「+ message.size()); testService.someMethod(tableDetails); } –
karthi