使用通配符方式时,一直报404错误
struts.xml中的代码:
<struts>
<package name="default" namespace="/" extends="struts-default" >
<action name="Helloworld_*" method="{1}" class="com.imooc.action.Helloworld">
<result>/result.jsp</result>
<result name="a">/{1}.jsp</result>
<result name="up">/{1}.jsp</result>
</action>
</package>
</struts>Action中的代码:
public class Helloworld extends ActionSupport {
public String add(){
return "add";
}
public String update(){
return "update";
}
@Override
public String execute() throws Exception {
System.out.println("执行Action");
return SUCCESS;
}
}输入:http://localhost:8080/HelloWord/Helloworld.action
正常运行,但是输入:http://localhost:8080/HelloWord/Helloworld_add.action
就报404错误,自己看了好久,感觉代码没啥毛病呀,就是运行 不出来