念要在页面中读取数据库的图片

想要在页面中读取数据库的图片
本帖最后由 wind052311 于 2014-09-25 10:30:38 编辑
在页面中先点查看照片念要在页面中读取数据库的图片会弹出一个对话框,显示所要看的图片。这个图片是在数据库里的。求大神指教,如何写。。。没写过这个念要在页面中读取数据库的图片
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'wx_query.jsp' starting page</title>
    
    <script type="text/javascript">
    
    var allwidth;
$(function(){
allwidth = document.body.clientWidth;
var allheight = document.documentElement.offsetHeight;
$('#table').datagrid({ 
url:'<%=path%>/weixin_query/list',
title : '发送消息管理',
height : allheight,
width : allwidth,
nowrap : true,
striped : true,
fit : true,
fitColumns : true,
pagination : true,
rownumbers : true,
idField : 'id',
toolbar : '#tb',
columns : [ [ {
field : 'user_id',
title : '用户编号',
width : syj.getWidth(allwidth, 8),
rowspan : 2,
align : 'center'
}, {
field : 'user_name',
title : '用户姓名',
width : syj.getWidth(allwidth, 10),
rowspan : 2,
align : 'center'
}, {
field : 'send_time',
title : '发送时间',
width : syj.getWidth(allwidth, 10),
rowspan : 2,
align : 'center'
}, {
field : 'picture',
title : '查看照片',
width : syj.getWidth(allwidth, 10),
rowspan : 2,
align : 'center',
formatter:function(value,rec,index){
return '<a href="javascript:viewWx_input(\''+rec.id+'\')" style="text-decoration:none;">查看照片</a>';
}
}, {
field : 'neirong',
title : '查看内容',
width : syj.getWidth(allwidth, 10),
rowspan : 2,
align : 'center',
formatter:function(value,rec,index){
return '<a href="javascript:viewmsg(\''+rec.id+'\')" style="text-decoration:none;">查看微信</a>';
}
}
] ],
onLoadSuccess : function() {
$('#table').datagrid('clearSelections');
}

});
});
function viewmsg(user_id){
$('<div id="view"/>').dialog({
title:'查看微信内容',
    width:700,
    height:310,
    closed: false,  
    cache: false,  
    href: '<%=path%>/pages/wx/wx_input.jsp?user_id='+user_id,    
    modal: true,
    buttons:[{
     text:'关闭',
     iconCls:'icon-cancel',
     handler:function(){$('#view').dialog('close');}
    }],
    onClose:function (){
     $('#view').dialog('destroy');
}
});
}
function querylist() {
var query = {
user_name : $('#q_user_name').val(),
};//组装json格式的数据
$("#table").datagrid('options').queryParams = query; //把查询条件赋值给datagrid内部变量
$("#table").datagrid('load'); //重新加载
}
function formReset() {
$('#q_user_name').val('');
querylist();
}
</script>
  </head>
  
  <body>
   <table id="table"></table>
    <div id="tb" style="height: auto;">
<table cellspacing="2" cellpadding="0" border="0">
<tbody>
<tr>
<td width="55px" class="td-title">
姓名
</td>
<td width="150px">
<input type="text" name="q_user_name" id="q_user_name" class="txt"
style="width: 90%;">
</td>
<td>
<a href="javascript:querylist()" class="easyui-linkbutton"
iconCls="icon-search">查询</a>
<a href="javascript:formReset()" class="easyui-linkbutton"
iconCls="icon-undo">重置</a>
</td>
</tr>
</tbody>
</table>
</div>
  </body>
</html>

------解决思路----------------------
public class ShowImagesServlet extends HttpServlet {