Spring MVC 3 映射

发布于 2024-12-25 23:55:27 字数 126 浏览 2 评论 0原文

这看似简单,但尚未找到解决方案。 如何映射到我的应用程序 www.mysite.com.br/MyController 而不是 www.mysite.com.br/servlet-name/MyController。

谢谢

This may seem simple, but not yet found a solution.
How to map to my applications www.mysite.com.br/MyController instead of www.mysite.com.br/servlet-name/MyController.

Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

醉生梦死 2025-01-01 23:55:28

鉴于您使用的是 Tomcat,您可能需要将上下文根设置为服务器的默认根。

如果您的应用程序是在 server.xml 中配置的,那么这意味着您将 上的 path 属性设置为空字符串,即“ ”。

<Context docBase="webapps/MyWAR" path=""></Context>

请参阅 http://tomcat.apache.org/tomcat-6.0-doc/ config/context.html

如果您在 IDE 中运行 Tomcat,还有其他方法可以设置路径属性,例如直接从 Eclipse。在 Eclipse 中,您可以在服务器窗口的“模块”选项卡中设置路径属性。

Given that you're using Tomcat, you probably need to set your context root to be the default for your server.

If your application is configured in server.xml then this means you set the path attribute on <Context> to an empty string, ie "".

<Context docBase="webapps/MyWAR" path=""></Context>

See http://tomcat.apache.org/tomcat-6.0-doc/config/context.html

There are other ways of setting the path attribute if you're running Tomcat in an IDE, for example directly from Eclipse. In Eclipse you set the path attribute in the Modules tab on the server window.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文