天天看点

struts1 redirect issue

近日突然发现struts1 的redirect有很大的限制,它只能redirect到APP domain下的某个URL,超出了domain的resource是无法访问的(如web server上的html)!

例如:

可以redirect 到以下URL:

但是无法redirect 到超出APP的URL:

具体见下面代码:

而且注意,如果不指定具体的action type,redirect是不起作用的!

例如下面的action例子,redirect不工作,因为没有指定具体的type:

要让redirect工作,应该像下面这样配置:

具体参见RequestProcessor的代码。