关于struts2 动态action 的问题
下面是我的struts2.xml的配置,有一个action :<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.3//EN"
"http://struts.
<struts>
<constant name="struts.enable.DynamicMethodInvocation" value="false" />
<constant name="struts.devMode" value="true" />
<package name="default" namespace="/" extends="struts-default">
<action name="first" class="FirstAction" >
<result>
/Hello.jsp
</result>
<result name="add">
/add.jsp
</result>
<result name="update">
/update.jsp
</result>
</action>
</package>
</struts>
然后是我定义的action 类:
import com.opensymphony.xwork2.ActionSupport;
public class FirstAction extends ActionSupport {
@Override
public String execute() throws Exception {
return SUCCESS;
}
public String update() throws Exception {
return "update";
}
public String add() throws Exception {
return "add";
}
}
问题来了,我在地址栏敲入http://localhost:8080/struts_test_1.0/first 的时候能够正常打开Hello.jsp页面,但是我敲入http://localhost:8080/struts_test_1.0/first!add 或者敲入者http://localhost:8080/struts_test_1.0/first!update 的时候就出错了,提醒如下:
There is no Action mapped for namespace [/] and action name [first!add] associated with context path [/struts_test_1.0].
为什么会这样?怎么解决??求助