-1
我正在從前端Web應用程序獲取請求參數並相應地顯示結果。<exceptionMessage> [Ljava.lang.String;與java.lang.String不兼容</ exceptionMessage>
Map<String,Object> requestparms
testObj.setUserId(requestparms.get("userId") == null ? null :requestparms.get("userId").toString());
當我測試使用RESTClient實現我得到以下錯誤:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<error incidentId="22854566" correlationId="922f4150-4636-4b94-8ac6-71f8ed1935c1">
<exceptionMessage>[Ljava.lang.String; incompatible with java.lang.String</exceptionMessage>
</error>
我試圖
String userId = String.valueOf(requestparms.get("userId"));
System.out.println("The value of variable is " +userId);
還是同樣的錯誤。
有人可以請你提供相關的幫助信息嗎?
謝謝你在前進, 幸運
你在哪裏填充地圖? –
看起來像一個'String []'而不是'String'。 –
可能由嘗試使用對象設置字符串引起。在一個對象上調用toString()可能不會給你想要的東西。 – ChadNC