6 - Struts配置错误
There is no Action mapped for namespace [/] and action name [helloworld] associated with context path [/JavaWeb].
1. 检查struts.xml文件名是否写错
2.检查struts.xml是否放在默认src目录下
3.struts.xml中内容出错
Struts2 作用: 可以方便WEB-INF下jsp之间的相互访问
刚初学,弄了老半天,在WEB-INF的HelloWorld.jsp就是没法跳转,终于弄好了,贴一个,以后借鉴一下
对应的struts.xml配置文件
<struts> <package name="default" extends="struts-default"> <action name="HelloWorld" class="com.zxm.action.HelloWorld"> <result name="success">/WEB-INF/HelloWorld.jsp</result> <!-- 不知道为啥,加了/WEB-INF/之后,就能正常访问HelloWorld.jsp文件了 --> </action> </package> </struts>
最后,输入http://localhost:8080/Struts2/HelloWorld.action就好了