0
我有一個類(其中包括),這是從數據庫retreived現場圖片在JSP頁面的團塊圖像:顯示使用Spring MVC 3
public class Person {
String name;
Blob picture;
}
於是我的避風港控制器,我添加人物對象的模型
@RequestMapping(value = "/online", method = RequestMethod.GET)
public String getCurrentUser(Model model) {
Person person = getMyPerson()
model.addAttribute("person", person);
return "online";
}
最後我有一個.JSP頁面顯示用戶:
<html>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
..some tags
Persons name: ${person.name}
Persons picture: ?your_answer_here?
</html>
所以問題(顯然)是如何顯示BLOB字段作爲一個形象呢?我嘗試過並且失敗了。我真的不希望執行一個新的數據庫查詢,我只是想顯示我已經有圖像..
謝謝!實現一個新的控制器,用於輸出所述圖像 – KimAMartinsen