eclipse发布Web及路径问题

为了使项目默认部署到tomcat安装目录下的webapps中,show view—>servers—>找到需要修改的tomcat—>右击
①停止eclipse内的Tomcat服务器(stop)
②删除该容器中部署的项目(add and remove)
③清除该容器相关数据(clean)
④打开tomcat的修改界面(open)
⑤找到servers location,选择第二个(User tomcat Installation)
⑥修改deploy path为webapps
⑦保存关闭
需要说明的是①②③必须操作,否则下面的步骤会被置灰无法操作。
上面发布到webapp下,同样在这里能看到默认发布的位置:
G:\Eclipse_WorkSpace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\test
这个位置可以通过:
1,String t = Thread.currentThread().getContextClassLoader()
                .getResource("").getPath();
        int num = t.indexOf("centerbusiness");
        String mysqlPathString = t.substring(1, num).replace('/', '\\')
                + "test\\mysql";
2,  // String pathString=System.getProperty("web.root");//这个需要怎web.xml中进行配置<context-param>
    <param-name>webAppRootKey</param-name>
    <param-value>web.root</param-value>
</context-param>
<listener>
    <listener-class>org.springframework.web.util.WebAppRootListener</listener-class>
</listener>

猜你喜欢

转载自blog.csdn.net/u010446936/article/details/53009377
今日推荐