我不确定如何设置上下文路径.当我.war file在tomcat中重命名时autodeploy,网页会localhost:8080/newDirectory按预期进行,但出于某种原因,无论pageContext.request.contextPath在基于Spring的页面中有什么调用,它仍会返回旧的上下文路径.
我试图通过设置覆盖上下文路径:
<context path="/newDirectory" docBase="appName" override="true"></context>
Run Code Online (Sandbox Code Playgroud)
在server.xml但它不起作用.
我的问题是,Spring从哪里读取它的上下文路径?我用了Maven,我确实看到了
<appContext>/${project.artifactId}</appContext>
Run Code Online (Sandbox Code Playgroud)
在pom.xml,这是否意味着我需要将artifactId重命名为newDirectory?
我也试过添加它<context path="/newDirectory"...> in /META-INF/context.xml(现在我知道由于我的server.xml改变,无论如何都会被忽略).
提前感谢您的回答.