Struts2 重定向.do URL到.action URL?
我在应用程序中将struts1页面迁移到struts2。但是,我仍然需要旧页面的URL“/login.do”以便向后兼容 如何将“login.do”URL重定向/映射到“login.action” 我相信这可以通过编写一个过滤器类来实现,但我不想这样做,因为这对于任务来说太复杂了。必须有一种在web.xml、struts.xml或struts-config.xml中实现的方法Struts2 重定向.do URL到.action URL?,struts2,struts,web.xml,Struts2,Struts,Web.xml,我在应用程序中将struts1页面迁移到struts2。但是,我仍然需要旧页面的URL“/login.do”以便向后兼容 如何将“login.do”URL重定向/映射到“login.action” 我相信这可以通过编写一个过滤器类来实现,但我不想这样做,因为这对于任务来说太复杂了。必须有一种在web.xml、struts.xml或struts-config.xml中实现的方法 我会给回答最好的人买一杯啤酒(在凤凰城) 更改操作扩展名。这是来自: 但是,常量的XML配置是首选的,因此我将它放在您的
我会给回答最好的人买一杯啤酒(在凤凰城) 更改操作扩展名。这是来自: 但是,常量的XML配置是首选的,因此我将它放在您的
struts.XML
中
它还避免了实际的重定向,尽管用于重定向的筛选器很简单。谢谢您的回复。我忘了提到应用程序当前正在迁移到struts2,并且将.do操作扩展添加到struts2的配置会导致所有struts1实现失败。在可预见的将来,将有struts1代码在使用。我想我必须使用一个筛选器类。@user1438547或在替换S1操作时重定向/转发S1操作,等等。
### Used by the DefaultActionMapper
### You may provide a comma separated list, e.g. struts.action.extension=action,jnlp,do
### The blank extension allows you to match directory listings as well as pure action names
### without interfering with static resources, which can be specified as an empty string
### prior to a comma e.g. struts.action.extension=, or struts.action.extension=x,y,z,,
struts.action.extension=action,,