我在服务器的d:\mmm\applications\image\1.jpg  文件
我现在要在d:\mmm\applications\reg\add.jsp文件里  显示这个图片,可以怎么写???
我目前错误的处理方法如下:
<img src="绝对路径">   这种方式不能显示图片,我右击这张没显示的图片   它的地址为(file:///D:/mmm/applications/image/1.jpg)
<img src="applications\\image\\1.jpg">  也不能显示图片  它的地址为(http://localhost:6888/mmm/applications/reg/applications/image/1.jpg)我如何可以直接定位到这张图片,把它显示出来??????

解决方案 »

  1.   

    <img src="/mmm/application/image/1.jpg">  
    你试一下
      

  2.   

    <img src="<%=request.getContextPath()%>/image/1.jpg">
      

  3.   

    response.setHeader("Pragma","No-cache"); 
    response.setHeader("Cache-Control","no-cache"); 
    response.setDateHeader("Expires", 0); 
    String servlet_path=request.getServletPath();
    System.out.println("servlet_path="+servlet_path);
    String context_path=request.getContextPath();
    System.out.println("context_path="+context_path);
    String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+context_path+"/";
    System.out.println("basePath="+basePath);
      

  4.   


    按照你的描述,应用的根应该是d:\mmm\applications。
    正确的写法为:
    <img src="../image/1.jpg" width="16" height="16" border="0" alt="">