问题
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.
来源:https://stackoverflow.com/questions/25705860/using-convention-plugin-with-struts-xml