通配符問(wèn)題,百思不得求解,求大佬點(diǎn)撥
警告: 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("執(zhí)行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版本的問(wèn)題吧 是不是要添加allow-methods
2017-10-09
看看你的報(bào)錯(cuò),namespace的問(wèn)題。
2017-10-08
就是照你所說(shuō)的寫(xiě)得代碼啊,可是還是顯示404錯(cuò)誤啊
2017-10-07
肯定不對(duì)啊,action name="helloworld_*" method="{1}" 表示你響應(yīng)的只能是helloworld_*.action的動(dòng)作,比如說(shuō)響應(yīng)helloworld_login.action,而method{N}代表前面的第N個(gè)*匹配子串,意思是跳轉(zhuǎn)到login.jsp頁(yè)面??纯茨阌袑?xiě)了這些相應(yīng)的action沒(méi),以及jsp頁(yè)面有與之對(duì)應(yīng)的沒(méi)