There is no Action mapped......

今天使用struts2 annotation,写了相关jsp文件和继承了ActionSupport的Action类,请求路径都是对的,但老是报错:html

There is no Action mapped......apache

后来网上查了下,原来是Action类除了要继承Action或者名字是XxxAction以外,所在的包也要是struts/struts2/action/actions中的其中一个,否则会扫描不到本身的Action类;app

apache给出了说明:http://struts.apache.org/docs/convention-plugin.html#ConventionPlugin-Codebehindhelloworld jsp

These packages are located by the Convention plugin using a search methodology. First the Convention plugin finds packages named strutsstruts2action or actions. Any packages that match those names are considered the root packages for the Convention plugin. Next, the plugin looks at all of the classes in those packages as well as sub-packages and determines if the classes implement com.opensymphony.xwork2.Action or if their name ends with Action (i.e. FooAction)。ide

相关文章
相关标签/搜索