【发布时间】:2011-10-21 20:50:42
【问题描述】:
我有一个类(其中包括)从数据库中检索的字段图片:
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 字段显示为图像?我已经尝试过但失败了。我真的不想对数据库执行新查询,我只想显示我已经拥有的图像..
【问题讨论】:
标签: spring jsp spring-mvc