问题描述
图片在数据库中以连接<image src="">的方式存在..我可以用ibatis把这个字符串读出来怎么在jsp页面中显示这个图片呢具体的代码是什么?谢谢!!!
解决方案
可以仿造下面例子 将<img>字符遍历出来 设置td div里就随你自己啦<%@ page language="java" import="java.util.*" pageEncoding="GBK"%><%@ taglib uri="http://struts.apache.org/tags-html" prefix="html"%><%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic"%><%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean"%><%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 'display.jsp' starting page</title> <meta http-equiv="pragma" content="no-cache"><meta http-equiv="cache-control" content="no-cache"><meta http-equiv="expires" content="0"> <meta http-equiv="keywords" content="keyword1,keyword2,keyword3"><meta http-equiv="description" content="This is my page"><!--<link rel="stylesheet" type="text/css" href="styles.css">--> </head> <body> <form> <table> <tr> <td>编号</td> <td>客户名称</td> <td>商品名称</td> <td>订单金额</td> <td>下单日期</td> </tr> <logic:iterate id="item" name="list"> <tr> <td>${item.ordereId}</td> <td>${item.custName}</td> <td>${item.prodName}</td> <td>${item.orderCount}</td> <td><bean:write name="item" property="orderDate" format="yyyy年MM月dd日"></bean:write></td> </tr> </logic:iterate> </table> </form> </body></html>
解决方案二:
${item.image} 这样就可以了