I'm using convention plugin in my project and everything was fine until I needed to add a custom Interceptor. To add a custom Interceptor I need to have struts.xml in my project. But when I add struts.xml, it gives me 404 error for every page. I have tried this solution but it doesn't seem to work. Thanks.
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
The struts.xml
configuration file should be in the source folder, such as src
or resources
. When you build the application the compiled output directed to WEB-INF/classes
. You can check this file exists before you deploy or start a server with already deployed web application.
FYI, the convention plugin doesn't replace the XWork configuration, but extend it with possibility to override. The struts.xml
is used by the same purpose, but using different configuration provider. So, configuring interceptors using convention plugin make sure you use the right parent package that contains your custom interceptor.