How to add Struts2 to a web application without web.xml?

北慕城南 提交于 2019-12-02 00:53:01

Without web.xml you can only write a Struts2 filter using servlet 3.0 or higher

@WebFilter("/*")
public class Struts2Filter extends Struts2PrepareAndExecuteFilter {
}

The content could be empty, it's enough to add annotated filter without any inclusion in the web.xml file.

If you want to integrate Struts2 with Spring, then you should use a plugin.

Struts 2 provides a plugin that enables Spring to inject into the ActionSupport classes any dependent objects you've specified in the Spring configuration file. Consult Spring Plugin documentation for more information about how the plugin works.

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