今天遇到这样一个问题:
调用http://127.0.0.1:8080/StrustTEST2/helloWorld
java.lang.NoSuchMethodException: com.test.strutsAction.HelloWorldAction.index()
struts.xml:
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.3//EN"
"http://struts.apache.org/dtds/struts-2.3.dtd">
<struts>
<!-- 搜索包路径 -->
<constant name="struts.convention.package.locators" value="example,strutsAction" />
</struts>
web.xml加入以下属性:
<display-name>Struts 2 Rest Example</display-name>