帝王 发表于 2018-11-29 12:23:19

tomcat的web-inf

  web-inf下,tomcat把它指为禁访目录,即直接在浏览器里是不能访问到的.
  但是可以让servlet进行访问,如web-inf下有a.jsp则可以用request.getRequestDispatcher( "/WEB-INF/a.jsp ").forward(request,response);
  如果你想访问web-inf下的htm文件的话,用request.getRequestDispatcher( "/WEB-INF/a.htm ").forward(request,response);是访问不了的。
  打开tomcat安装目录下conf下的web.xml文件,找到
  
   jsp
   *.jsp
  
  然后在它下面添加
  
  
   jsp
   *.html
  
  这样的话,你就能用request.getRequestDispatcher( "/WEB-INF/a.htm ").forward(request,response);去访问web-inf下的htm了

页: [1]
查看完整版本: tomcat的web-inf