JSP页面显示不了图片
寒雨诺 2015-01-13 09:29:40 java程序
....
String path = ServletActionContext.getServletContext().getRealPath("/WEB-INF/wpets/push/");
logger.info("path--------------"+path);
try
{
String file = UploadFile.uploadFiles(path, request);
logger.info("file--------------"+file);
request.getSession().setAttribute("img", file);
} catch (Exception e) {
e.printStackTrace();
}
return SUCCESS;
如上所示,上传图片之后返回图片路径将图片路径写到jsp页面
....
<img alt="图片" src="<%=basePath%>wpets/push/${img}"/>
....
显示不了图片。图片该怎样才能显示出来!