!和通配符方式都不能访问
struts2的jar包用的是2.5的
HTTP Status 404 - There is no Action mapped for namespace [/] and action name [HelloWorld_add_action] associated with context path [/HelloWorld].
HelloWorldAction.java
public class HelloWorldAction extends ActionSupport { // helloworld.action @Override public String execute() throws Exception { System.out.println("执行Action"); return SUCCESS; } public String add() { return "add"; } public String update() { return "update"; } }
struts.xml
<struts> <package name="default" namespace="/" extends="struts-default"> <action name="*_*" method="{2}" class="com.imooc.action.{1}Action"> <result >/result.jsp</result> <result name="add">/{2}.jsp</result> <result name="update">/{2}.jsp</result> </action> </package> <constant name="struts.enable.DynamicMethodInvocation" value="false"></constant> </struts>