1.项目运行后,可以进入index.jsp页面,但是访问调用action时浏览器报404异常
后台报错:
问题原因:There is no Action mapped for namespace [/] and action name [test] associated with context path [/Struts2_demo01]. - [unknown location] at com.opensymphony.xwork2.DefaultActionProxy.prepare(DefaultActionProxy.java:185)
解决办法:1.struts.xml文件应该配置在src下,修改后即可
2.因为Struts2 要求 strust.xml 文件显示在classes的文件夹里,所以我们要在WebContent/WEB-INF/classes 的文件夹下创建 struts.xml 文件, Eclipse并没有默认创建“classes”文件夹,因此你需要自己创建