我有一个 servlet,可以将字符串转换为 JSONObject,如下所示:
JSONObject myObject = new JSONObject("{'someKey':'someValue'}");
//sending it to the JSP with RequestDispatcher
request.setAttribute("jsonObject", myObject)
requestDispatcher.forward(request, response);
现在在 JSP 中,我尝试使用 EL 表达式 ${jsonObject.someKey}
访问它,但出现以下错误:
javax.el.PropertyNotFoundException: The class 'org.json.JSONObject' does not have the property 'someKey'.
最佳答案
希望有帮助。
${jsonObject.get("someKey")}
关于java - 使用 EL 表达式访问 JSP 中的 JSONObject 属性,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58414108/