前端發json請求到後端,本來是想發到一個叫做getAllUsersAction的action的,但是另一action(getUserAction)居然也有返回,這是怎麼回事?
Ajax:
$http({
method:"POST",
url:"/AzraelShop/Mgr-getAllUsers",
data:{
}
}).success(function(result){
$scope.userList = result.userList;
}).error(function(result){
alert("error");
})
struts.xml:
<action name="Mgr-*User" class="com.azrael.controller.MgrController" method="{1}UserAction">
<interceptor-ref name="completeStack"></interceptor-ref>
<interceptor-ref name="json">
<param name="contentType">application/json</param>
</interceptor-ref>
<result type="json">
<param name="includeProperties">user.*</param>
</result>
</action>
<action name="*-*" class="com.azrael.controller.{1}Controller" method="{2}Action">
<interceptor-ref name="completeStack"></interceptor-ref>
<interceptor-ref name="json">
<param name="contentType">application/json</param>
</interceptor-ref>
<result type="json"/>
</action>
收到的response:
我懂了。。。因為getUserAction和getAllUsersAction都是get開頭,被解析成了getter方法了。。。