<html:img scr="">应该会有这个属性的吧?

解决方案 »

  1.   

    <img src="<%=你的图片的位置%>" />
      

  2.   

    1.你在存入数据库的时候存入图片名和类型就行了(如:*.jpg/*.gif....)
    2.当你拿到这个名字的时候你通过
      <html:img src=""/>这个标签显示~这里有个问题就是struts标签不认jsp中的<%=%>
    只能用<bean:write />标签来代替变量如:<html:img src="../images/<bean:write name="PicName"/>"/>
      

  3.   

    通过数据库拿出图片,需要你将你的图片数据按照二进制放入数据库或者同等效果的方法(例如BASE64编码成String),然后编写一个action,将数据按照流方式写入页面的response,然后调用该action,即返回图片的数据。然后调用方式与普通方式相同,只是图片的src写成你的action地址。采用该方式拿数据,可以效验request相关信息,例如判断session等。 Object result = actionService.service(paramMap, request); //Object是从数据库查询出来的二进制数据
    if(result != null){
    //页面不缓存
    response.setHeader("Pragma", "No-cache");
    response.setHeader("Cache-Control", "no-cache");
    response.setDateHeader("Expires", 0); String contentType = paramMap.get(Constants.CONTENT_TYPE_KEY);
    if(contentType != null)
    response.setContentType(contentType);
    String contentDisposition = paramMap.get(Constants.CONTENT_DISPOSITION_KEY);
    if(contentDisposition != null)
    response.setHeader("Content-disposition", contentDisposition);
    response.getOutputStream().write((byte[])result);
    response.getOutputStream().close();
    }
      

  4.   

    调用类似这样:
    <html:img imageName="img${rows.userInf.userId}" action="user/iconReader.do?iconId=${rows.userInf.personUserInf.iconId}" />