Struts与Servlet的冲突

今天在使用Struts时,发现在用servlet时会报

There is no Action mapped for namespace [/] and action name [UserInfoCollection] associated with context path [/ShowMail_SSI]. - [unknown location]

原因是在web.xml设置过滤器的时候直接使用

会将servlet过滤掉。

如果要同时使用struts和servlet,需要将servlet的filter设置在struts前面

这个filter中init-param必须加上所有的servlet。然后在servletfilter中进行过滤,将servlet转发到相应地址,将struts使用chain.filter(request,response)转到struts的filter

原文地址:https://www.cnblogs.com/charlexu/p/2889479.html