{"id":251,"date":"2009-07-25T20:37:09","date_gmt":"2009-07-25T12:37:09","guid":{"rendered":"http:\/\/amjet.dyndns.biz\/blog\/IT\/?p=251"},"modified":"2013-03-01T19:49:55","modified_gmt":"2013-03-01T11:49:55","slug":"ognl-methodfailedexception-method-setqty-failed-for-object-com-amjet-sales-model-order","status":"publish","type":"post","link":"https:\/\/blog.amjet.biz\/IT\/?p=251","title":{"rendered":"ognl.MethodFailedException: Method &#8220;setQty&#8221; failed for object com.amjet.sales.model.Order"},"content":{"rendered":"<p>\u6700\u8fd1\u5beb\u4e00\u500b struts2 action \u50b3\u56de json \u8cc7\u6599\uff0c\u6e2c\u8a66\u6642\u767c\u751f\u4e0a\u9762\u7684\u932f\u8aa4\u3002\u539f\u56e0\u662f\u9801\u9762\u7684 jquery \u5143\u4ef6\u900f\u904e post method \u9001\u51fa &#8220;order.qty&#8221; \u7684\u53c3\u6578\uff0cstruts2 \u7684 interceptor \u5728\u6536\u5230\u53c3\u6578\u5f8c\u60f3\u8981\u8a2d\u5b9a action \u5167 order \u7269\u4ef6\u7684 qty property\uff0c\u4e8b\u5be6\u4e0a\u6211\u4e0d\u9700\u8981 struts2 \u4f5c parse \u53c3\u6578\u53ca\u8a2d\u5b9a\u7269\u4ef6\u7684\u52d5\u4f5c\uff0c\u53c3\u6578\u6211\u60f3\u5728 action \u5167\u7528 request.getParameter() \u81ea\u5df1\u63a5\u53d6\u8655\u7406\u3002\u4ee5\u4e0b\u7684 action \u8a2d\u5b9a\u7bc4\u4f8b\u53ef\u4ee5\u8b93 interceptor \u5ffd\u7565\u958b\u982d\u70ba order \u7684\u53c3\u6578\uff0c\u7531\u65bc struts2 \u9810\u8a2d\u4e5f\u6703\u5ffd\u7565\u958b\u982d\u70ba dojo,struts \u7684\u53c3\u6578\uff0c\u6211\u5011\u4e5f\u4e00\u4f75\u4fdd\u7559\uff1a<\/p>\n<p>&lt;action name=&#8221;updateSell&#8221; method=&#8221;jsonUpdate&#8221;<br \/>\nclass=&#8221;com.amjet.sales.web.action.SellAction&#8221;&gt;<br \/>\n<strong>&lt;interceptor-ref name=&#8221;defaultStack&#8221;&gt;<br \/>\n&lt;param name=&#8221;params.excludeParams&#8221;&gt;^order\\..*,dojo\\..*,^struts\\..*&lt;\/param&gt;<br \/>\n&lt;\/interceptor-ref&gt;<\/strong><br \/>\n&lt;result type=&#8221;json&#8221;&gt;<br \/>\n&lt;param name=&#8221;target&#8221;&gt;jquery&lt;\/param&gt;<br \/>\n&lt;\/result&gt;<br \/>\n&lt;\/action&gt;<\/p>\n<p><strong>[ratings]<\/strong><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6700\u8fd1\u5beb\u4e00\u500b struts2 action \u50b3\u56de json \u8cc7\u6599\uff0c\u6e2c\u8a66\u6642\u767c\u751f\u4e0a\u9762\u7684\u932f\u8aa4\u3002\u539f\u56e0\u662f\u9801\u9762\u7684 jquery \u5143\u4ef6\u900f\u904e post method \u9001\u51fa &#8220;order.qty&#8221; \u7684\u53c3\u6578\uff0cstruts2 \u7684 interceptor \u5728\u6536\u5230\u53c3\u6578\u5f8c\u60f3\u8981\u8a2d\u5b9a action \u5167 order \u7269\u4ef6\u7684 qty property\uff0c\u4e8b\u5be6\u4e0a\u6211\u4e0d\u9700\u8981 struts2 \u4f5c parse \u53c3\u6578\u53ca\u8a2d\u5b9a\u7269\u4ef6\u7684\u52d5\u4f5c\uff0c\u53c3\u6578\u6211\u60f3\u5728 action \u5167\u7528 request.getParameter() \u81ea\u5df1\u63a5\u53d6\u8655\u7406\u3002\u4ee5\u4e0b\u7684 action \u8a2d\u5b9a\u7bc4\u4f8b\u53ef\u4ee5\u8b93 interceptor \u5ffd\u7565\u958b\u982d\u70ba order \u7684\u53c3\u6578\uff0c\u7531\u65bc struts2 \u9810\u8a2d\u4e5f\u6703\u5ffd\u7565\u958b\u982d\u70ba dojo,struts \u7684\u53c3\u6578\uff0c\u6211\u5011\u4e5f\u4e00\u4f75\u4fdd\u7559\uff1a &lt;action name=&#8221;updateSell&#8221; method=&#8221;jsonUpdate&#8221; class=&#8221;com.amjet.sales.web.action.SellAction&#8221;&gt; &lt;interceptor-ref name=&#8221;defaultStack&#8221;&gt; &lt;param name=&#8221;params.excludeParams&#8221;&gt;^order\\..*,dojo\\..*,^struts\\..*&lt;\/param&gt; &lt;\/interceptor-ref&gt; &lt;result type=&#8221;json&#8221;&gt; &lt;param name=&#8221;target&#8221;&gt;jquery&lt;\/param&gt; &lt;\/result&gt; &lt;\/action&gt; [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[133,33],"class_list":["post-251","post","type-post","status-publish","format-standard","hentry","category-java","tag-java","tag-struts2"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/blog.amjet.biz\/IT\/index.php?rest_route=\/wp\/v2\/posts\/251","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.amjet.biz\/IT\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.amjet.biz\/IT\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.amjet.biz\/IT\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.amjet.biz\/IT\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=251"}],"version-history":[{"count":5,"href":"https:\/\/blog.amjet.biz\/IT\/index.php?rest_route=\/wp\/v2\/posts\/251\/revisions"}],"predecessor-version":[{"id":687,"href":"https:\/\/blog.amjet.biz\/IT\/index.php?rest_route=\/wp\/v2\/posts\/251\/revisions\/687"}],"wp:attachment":[{"href":"https:\/\/blog.amjet.biz\/IT\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=251"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.amjet.biz\/IT\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=251"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.amjet.biz\/IT\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=251"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}