java web项目配置Tomcat访问项目外文件

    1、在代码中将111.png存在D:\aaa\路径下

    2、修改tomcat conf文件夹下server.xml中 context

      <Context path="/aaa" docBase="D:\aaa" debug="0"  reloadable="true" />

    3、访问;例如目前你的项目路径http://localhost:8080/ggxs/index.jsp

      图片路径:http://localhost:8080/aaa/111.png

 

   切记我们在tomcat里配置后 再访问时的路径是不加项目名(ggxs)的,直接在http://localhost:8080/  tomcat配置的别名  / 文件名

 

 

                                        ————————只为延续被帮助过的感动。

posted on 2020-03-12 16:49  0o好好先生o0  阅读(676)  评论(0编辑  收藏  举报

导航