0
我傳遞一個HashMap到JSP觀點如下:JSP錯誤試圖訪問的HashMap變量
@RequestMapping(value = "/query")
public String processRegistration(@ModelAttribute("query") Query query,
Map<String, Object> model) {
...
HashMap<String, String> serviceRequestData = executeSelect(conn, stmt, query);
model.put("serviceRequestData", serviceRequestData);
...
}
,並試圖在HashMap中的關鍵「FN_Contact」訪問值在JSP頁面如下:
<c:choose>
<c:when test="${empty ${serviceRequestData[FN_Contact]}}">
</c:when>
<c:otherwise>
<h3>Results:</h3>
<h5>FirstName:</h5>
${serviceRequestData[FN_Contact]}<br>
</c:otherwise>
</c:choose>
在這個jsp中,我試圖檢查值是否爲空,如果是則什麼也不做,否則打印數據。我收到以下語法錯誤:
javax.el.ELException: Failed to parse the expression [${empty ${serviceRequestData[FN_Contact]}}]