Spring BeanNameUrlHandlerMapping 映射模式 url

发布于 2024-11-14 08:30:27 字数 1592 浏览 2 评论 0原文

我有一个关于 Spring 中的 BeanNameUrlHandlerMapping 的特殊查询。我的 Dispatcher-servlet.xml 的一部分如下所示 -

<bean id="beanNameUrl" class="org.springframework.web.servlet.handler.BeanNameUrlHandlerMapping"/>

<bean name="/start.htm" class="controller.StartController"/>
<bean name="/login.htm" class="controller.LoginController"/>
<bean name="/company.htm" class="controller.CompanyController"/>
<bean name="/client.htm" class="controller.ClientController"/>
<bean name="/paginate.htm" class="controller.PaginateController"/>
<bean name="/detail_view.htm" class="controller.DetailViewController"/>
<bean name="/edit_view.htm" class="controller.EditViewController"/>
<bean name="/create_view.htm" class="controller.CreateViewController"/>
<bean name="/building.htm" class="controller.BuildingController"/>
<bean name="/tower.htm" class="controller.TowerController"/>
<bean name="/floor.htm" class="controller.FloorController"/>
<bean name="/space.htm" class="controller.SpaceController"/>
<bean name="/contract.htm" class="controller.ContractController"/>
<bean name="/space_package.htm" class="controller.SpacePackageController"/>
<bean name="/charge_head.htm" class="controller.ChargeHeadController"/>
<bean name="/search_view.htm" class="controller.SearchViewController"/>

现在,发生的情况是,每当我尝试访问 space_package.htm 时,它总是以 space.htm 结束,最重要的是,无论我输入什么来代替* 在 http://host:port/app_name/space*.htm 中,它总是以 space.htm 结尾!

请告知我应该如何解决这个问题以及我该去哪里。

感谢您的帮助...:)

I have this particular query regarding BeanNameUrlHandlerMapping in Spring. Part of my dispatcher-servlet.xml looks like below -

<bean id="beanNameUrl" class="org.springframework.web.servlet.handler.BeanNameUrlHandlerMapping"/>

<bean name="/start.htm" class="controller.StartController"/>
<bean name="/login.htm" class="controller.LoginController"/>
<bean name="/company.htm" class="controller.CompanyController"/>
<bean name="/client.htm" class="controller.ClientController"/>
<bean name="/paginate.htm" class="controller.PaginateController"/>
<bean name="/detail_view.htm" class="controller.DetailViewController"/>
<bean name="/edit_view.htm" class="controller.EditViewController"/>
<bean name="/create_view.htm" class="controller.CreateViewController"/>
<bean name="/building.htm" class="controller.BuildingController"/>
<bean name="/tower.htm" class="controller.TowerController"/>
<bean name="/floor.htm" class="controller.FloorController"/>
<bean name="/space.htm" class="controller.SpaceController"/>
<bean name="/contract.htm" class="controller.ContractController"/>
<bean name="/space_package.htm" class="controller.SpacePackageController"/>
<bean name="/charge_head.htm" class="controller.ChargeHeadController"/>
<bean name="/search_view.htm" class="controller.SearchViewController"/>

Now, what happens is, whenever am trying to get to the space_package.htm, it always ends up in space.htm and to top it all, whatever I type in place of the * in http://host:port/app_name/space*.htm, it always end up in space.htm !!

Please advise how should I resolve this and where am I going worng.

Appreciate your help...:)

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

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

发布评论

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

评论(1

傲影 2024-11-21 08:30:27

URL 的命名不正确。根据Web标准,URL不能包含特殊字符(如“_”),因此/space_package.html无效。您可能想尝试 /spacePackage.html

如需进一步了解,您可以参考此链接中的文档。

The URLs are named incorrectly. According to web standard, An URL can not contain special character (like "_"), so that /space_package.html is invalid. You may want to try /spacePackage.html instead.

For further understanding, you can refer the document in this link.

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