通配符問題,百思不得求解,求大佬點撥
警告: Could not find action or result: /HelloWorld/helloworld_add.action
There is no Action mapped for namespace [/] and action name [helloworld_add] associated with context path [/HelloWorld]. - [unknown location]
public class HelloWorldAction extends ActionSupport {
? ?
? ??
? ? public String add() {
? ? System.out.println("執行add");
? ? return "add";
? ? }
? ? public String update() {
? ? return "update";
? ? }
<struts>
? <package name="default" namespace="/" extends="struts-default">
? ?<action name="helloworld_*" method="{1}" class="com.imooc.action.HelloWorldAction">
? ? ?<result>/index.jsp</result>
? ? ?<result name="add">/{1}.jsp</result>
? ? ?<result name="update">/{1}.jsp</result>
? ?</action> ?
??
? </package>
?<constant name="struts.enable.DynamicMethodInvocation" value="false"></constant>
</struts>
2020-02-11
2018-11-01
添加allowed-method, 參考 https://www.jianshu.com/p/b6c961a1a141
2018-08-01
struts2版本的問題吧 是不是要添加allow-methods
2017-10-09
看看你的報錯,namespace的問題。
2017-10-08
就是照你所說的寫得代碼啊,可是還是顯示404錯誤啊
2017-10-07
肯定不對啊,action name="helloworld_*" method="{1}" 表示你響應的只能是helloworld_*.action的動作,比如說響應helloworld_login.action,而method{N}代表前面的第N個*匹配子串,意思是跳轉到login.jsp頁面??纯茨阌袑懥诉@些相應的action沒,以及jsp頁面有與之對應的沒