[英]Tomcat : Context path not being set
I have a web app set up and running on Tomcat 8 with the project WAR file in the webapps folder in the tomcat directory. 我在Tomcat 8上设置并运行了一个Web应用程序,并在tomcat目录的webapps文件夹中使用了项目WAR文件。 If i use any of the following links my project works fine
如果我使用以下任何链接,我的项目都可以正常运行
http://localhost:8066/myWebApp/home/
http://localhost:8066/myWebApp/booking/
http://localhost:8066/myWebApp/contactUs/
i want to set it so the above URL's work but also the following URL's which have /app
added after the project name 我想将其设置为上面的URL,但还要在项目名称后添加
/app
的以下URL
http://localhost:8066/myWebApp/app/home/
http://localhost:8066/myWebApp/app/booking/
http://localhost:8066/myWebApp/app/contactUs/
i have set the path
in the context.xml
file as seen below 我已经在
context.xml
文件中设置了path
,如下所示
<Context docBase="myWebApp" path="/app" reloadable="true"> ... <Context>
but this does not work. 但这不起作用。 am i doing this wrong or how can i go about doing this?
我做错了还是该怎么做?
EDIT : 编辑:
I can do this in eclipse by going to the server tab, opening the server and looking in the modules tab, so how do i do this on the Tomcat itself 我可以在Eclipse中通过以下方法来执行此操作:转到“服务器”选项卡,打开服务器,然后在“模块”选项卡中查找,那么我该如何在Tomcat本身上执行此操作
You maybe use UrlRewriteFilter : 您可能使用UrlRewriteFilter :
1. Add dependence 1.增加依赖性
2. Change web.xml
2.更改
web.xml
3. Set rule in WEB-INF\\urlrewrite.xml
3.在
WEB-INF\\urlrewrite.xml
设置规则
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.