从数据库获取的图片路径放到jsp中,当访问页面时却没有图片,只有这么个东西,实在不知道怎么解决,求大神指点!
jsp代码如下:
<%@page import="com.gxy.bean.GxyProduct"%>
<%@ 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">
商品列表如下:
<%
if (request.getAttribute("products") != null) {
List products = (List) request
.getAttribute("products");
for (GxyProduct product : products) {
String picpath = product.getImg().replaceAll("\\", "/");
%>