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

相關文章
相關標籤/搜索