apache tomcat 必须要加 WebRoot 才能访问的解决方法

Tomcat上的手动部署
:访问路径如果必须要加WebRoot才能访问的解决方法

如题必须这样才能访问的情况

 http://localhost:8080/你的项目/WebRoot/index.jsp

解决办法:
 ①、 在conf/server.xml中的</host>前加入<Context path="/myjsp" docBase="D:\java \apache-tomcat-5.5.27\webapps\myjsp\WebRoot" reloadable="true"/> 

其中/myjsp 是你的工程 ;D:\java \apache-tomcat-5.5.27\webapps\myjsp\WebRoot 是你的工程的WebRoot所在的绝对路径

②、修改 web.xml中的默认首页为index.jsp(文件的最后几行)加入  
  <welcome-file-list>
        <welcome-file>index.html</welcome-file>
        <welcome-file>index.htm</welcome-file>
        <welcome-file>index.jsp</welcome-file>
    </welcome-file-list>

保存 重启tomcat 现在访问http://localhost:8080/你的项目 ,  就能访问了

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值