Using convention plugin with struts.xml

∥☆過路亽.° 提交于 2019-12-23 05:08:54

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!