2015-10-20 88 views
0

我正在嘗試將參數傳遞給命令的e4應用程序。 我在應用程序模型中定義了參數,因此它們是字符串。 我忽略了參數的typeId。如何爲e4命令創建參數

Map<String, Object> parameter = new HashMap<String, Object>(); 
parameter.put("de.mdsd.e4.rap.kdn.joggathon.webeditor.commandparameter.username", username); 
parameter.put("de.mdsd.e4.rap.kdn.joggathon.webeditor.commandparameter.password", password); 
ParameterizedCommand cmd = commandService.createCommand("command.dologin", parameter); 

當我創建傳遞參數的命令時,我返回null,因爲commandService沒有爲我的參數找到一個轉換器。

哪種類型我必須在參數中指定以獲得簡單的字符串參數的工作?

+0

您究竟遇到什麼錯誤? –

+0

http://stackoverflow.com/q/19293503/2670892可能的重複 –

回答

0

你的版本是完全正常的,萬一「用戶名」和「密碼」從String類型。錯誤可能是其他地方產生的。 在填寫地圖之前,您可以嘗試parameters.clear();,以避免意外映射。