选择spring和struts,注意版本,不同的struts版本,过滤器的位置不一样
选择存放位置,并点击完成创建项目,在创建过程中会自动下载相关jar
初始化完成后的目录结构为
修复生成的web.xml文件
1.检查生成的struts2过滤器和选择的版本是否一致(现在我的是不匹配的需要修改StrutsPrepareAndExecuteFilter的位置)
2.spring的监听器ContextLoaderListener,因为没有生成spring-web-4.3.18.RELEASE.jar,所有要下载spring-web-4.3.18.RELEASE.jar,spring框架下载地址https://repo.spring.io/release/org/springframework/spring/
新的web.xml文件为:
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
struts2
index.jsp
org.springframework.web.context.ContextLoaderListener
struts2
org.apache.struts2.dispatcher.filter.StrutsPrepareAndExecuteFilter
struts2
<