Spring BeanNameUrlHandlerMapping 映射模式 url
我有一个关于 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
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.