在tomcat/webapps/test/images/下有图片1.GIF
用绝对路径则大小写不敏感,而用相对路径只能写images/1.GIF,如果写images/1.gif则找不到图片,这算是个bug吗?
PrintWriter pw = response.getWriter();
pw.println("<html>");
pw.println("<body>");
pw.println("<h1>用户登录界面</h1>");
pw.println("<img src='F:/Program Files/apache-tomcat-5.5.29/webapps/test/images/1.gif' ><br>");
pw.println("<form action = deal method = post>");
pw.println("用户名:<input type = text name = username> <br>");
pw.println("密码:<input type = password name = password> <br>");
pw.println("<input type = submit value = login> <br>");
pw.println("</form>");
pw.println("</body>");
pw.println("</html>");

解决方案 »

  1.   

    应该是操作系统对文件名大小写敏感。加载图片的时候HTML文件已经完全生成了,本次请求跟JSP相关的一切工作都结束了,剩下的都是HTML在操作。
    HTML本身大小写不敏感,但加载图片调用操作系统的文件处理系统加载文件,这个时候有可能是大小写敏感的。
      

  2.   

    感觉像是操作系统的关系,不是TOMCAT的问题呢,
      

  3.   

    我装的是win7,应该大小写不敏感吧?
      

  4.   

    是web服务器的问题。微软的服务器一般都不敏感的,java的一般都敏感