{"id":310,"date":"2016-03-28T16:32:40","date_gmt":"2016-03-28T08:32:40","guid":{"rendered":"http:\/\/www.xttblog.com\/?p=310"},"modified":"2016-03-28T16:34:01","modified_gmt":"2016-03-28T08:34:01","slug":"struts2-package%e5%b1%9e%e6%80%a7%e9%85%8d%e7%bd%ae%e8%af%a6%e8%a7%a3","status":"publish","type":"post","link":"https:\/\/www.xttblog.com\/?p=310","title":{"rendered":"Struts2 package\u5c5e\u6027\u914d\u7f6e\u8be6\u89e3"},"content":{"rendered":"<p>\n\t\u73b0\u5728\u7684\u7a0b\u5e8f\u5458\u90fd\u88ab\u6846\u67b6\u7ed9\u6bd2\u5bb3\u4e86\u3002\u4ec0\u4e48Spring\uff0cStruts2\u7b49\u6846\u67b6\u7684\u6a2a\u7a7a\u51fa\u4e16\uff0c\u8ba9\u7a0b\u5e8f\u5458\u66f4\u5173\u6ce8\u4e1a\u52a1\uff0c\u800c\u975e\u67b6\u6784\u3002\u4ee5\u81f3\u4e8e\u6211\u5728\u9762\u8bd5\u4e2d\u95ee\u9053Struts2\u5982\u4f55\u914d\u7f6epackge\u7684\uff0c\u56de\u7b54\u8005\u90fd\u8bb2\u4e0d\u6e05\u3002\u8fd9\u662f\u4e00\u79cd\u5e38\u89c1\u73b0\u8c61\uff0c\u4ece\u9879\u76ee\u4e00\u5f00\u59cb\uff0c\u6846\u67b6\u90fd\u642d\u597d\u4e86\uff0c\u5f88\u5c11\u518d\u505a\u6539\u52a8\u3002\u4eca\u5929\u6211\u4eec\u5728\u56de\u987e\u4e00\u4e0b\u76f8\u5173\u77e5\u8bc6\u3002\n<\/p>\n<p>\n\tpackage\u8282\u70b9\u662f\u6574\u4e2a\u914d\u7f6e\u7684\u6838\u5fc3\u90e8\u5206\u3002\u6bcf\u4e2apackage\uff0c\u4ece\u8bed\u4e49\u4e0a\u8bb2\uff0c\u5176\u5b9e\u4ee3\u8868\u4e86\u6bcf\u4e00\u4e2a\u72ec\u7acb\u7684\u6a21\u5757\u3002\u5728\u8fd9\u4e2a\u6a21\u5757\u4e2d\uff0c\u4f60\u53ef\u4ee5\u5b9a\u4e49\u96b6\u5c5e\u4e8e\u8fd9\u4e2a\u6a21\u5757\u7684\u884c\u4e3a\u65b9\u5f0f\uff0c\u800c\u4e0e\u5176\u4ed6\u7684\u6a21\u5757\u6ca1\u6709\u5173\u7cfb\u3002\u6240\u4ee5\uff0c\u6bcf\u4e2apackage\u90fd\u6709\u72ec\u7acb\u7684interceptor\u3001result-type\u548caction\u7684\u5b9a\u4e49\uff0c\u7edd\u5927\u591a\u6570\u7684Runtime\u914d\u7f6e\u5b9a\u4e49\u90fd\u662f\u901a\u8fc7package\u8282\u70b9\u5b9e\u73b0\u7684\u3002\u63a5\u4e0b\u6765\u6211\u4eec\u5c31\u6765\u8be6\u7ec6\u8ba8\u8bba\u4e00\u4e0bpackage\u4e2d\u7684\u5c5e\u6027\u548c\u5b50\u8282\u70b9\u3002<br \/>\n\t<span style=\"color:red;font-weight:bold\">1. name<\/span><br \/>\n\tname\u5c5e\u6027\u4e3a\u6bcf\u4e2apackage\u8bbe\u7f6e\u4e00\u4e2a\u552f\u4e00\u7684\u6807\u8bc6\uff0c\u8fd9\u4e2a\u6807\u8bc6\u5728\u6240\u6709\u7684package\u5b9a\u4e49\u4e2d\u4e0d\u80fd\u91cd\u590d\u3002<br \/>\n\t<span style=\"color:red;font-weight:bold\">2. abstract<\/span><br \/>\n\t\u6807\u8bc6\u8fd9\u4e2apackage\u7684\u5b9a\u4e49\u662f\u4e00\u4e2a\u62bd\u8c61\u5b9a\u4e49\uff0c\u4e5f\u5c31\u662f\u5141\u8bb8\u4ed6\u4ec5\u5305\u542b\u58f0\u660e\u5f0f\u7684\u5b9a\u4e49\uff0c\u800c\u4e0d\u9700\u8981\u5728package\u5b9a\u4e49\u4e2d\u5305\u542baction\u7684\u5b9a\u4e49\u3002<br \/>\n\t<span style=\"color:red;font-weight:bold\">3. extends<\/span><br \/>\n\t\u901a\u8fc7\u4f7f\u7528extends\uff0c\u4f60\u53ef\u4ee5\u6307\u5b9a\u672cpackage\u7ee7\u627f\u53e6\u5916\u4e00\u4e2apackage\u7684\u6240\u6709\u7684\u914d\u7f6e\u3002\u5f53\u67d0\u4e2apackage\u7ee7\u627f\u4e86\u53e6\u5916\u4e00\u4e2apackage\u7684\u6240\u6709\u914d\u7f6e\uff0c\u90a3\u4e48\u4f60\u5c31\u65e0\u9700\u5bf9\u7236package\u4e2d\u5df2\u7ecf\u58f0\u660e\u8fc7\u7684\u914d\u7f6e\u5b9a\u4e49\u505a\u518d\u6b21\u7684\u5b9a\u4e49\u3002 \u540c\u65f6\uff0c\u5982\u679c\u91cd\u590d\u5b9a\u4e49\u7236package\u4e2d\u5df2\u58f0\u660e\u8fc7\u7684\u914d\u7f6e\u5b9a\u4e49\uff0c\u90a3\u4e48\u8fd9\u4e9b\u91cd\u590d\u5b9a\u4e49\u58f0\u660e\u5c06\u8986\u76d6\u7236package\u4e2d\u7684\u76f8\u5173\u5b9a\u4e49\u3002<br \/>\n\t<span style=\"color:red;font-weight:bold\">4. namespace<\/span><br \/>\n\tnamespace\u7684\u4f5c\u7528\uff1a\u5bf9\u4e8eaction\u914d\u7f6e\u8fdb\u884c\u903b\u8f91\u5212\u5206\u3002<br \/>\n\t\u5982\u679c\u6211\u4eec\u4e0d\u4e3apackage\u8282\u70b9\u6307\u5b9anamespace\uff0cStruts2\u9ed8\u8ba4\u4f7f\u7528\u4e00\u4e2a\u7a7a\u5b57\u7b26\u4e32\u4f5c\u4e3a\u9ed8\u8ba4\u7684namespace\u3002\u5f53\u7136\uff0c\u4e5f\u53ef\u4ee5\u4f7f\u7528&quot;\/&quot;\u7b49\u5b57\u7b26\u4e32\u6765\u8868\u793anamespace\u3002<br \/>\n\t\u5b9a\u4e49package\u547d\u540d\u7a7a\u95f4 \u8be5\u547d\u540d\u7a7a\u95f4\u5f71\u54cd\u5230url\u7684\u5730\u5740\uff0c\u4f8b\u5982\u6b64\u547d\u540d\u7a7a\u95f4\u4e3a\/test\u90a3\u4e48\u8bbf\u95ee\u662f\u7684\u5730\u5740\u4e3ahttp:\/\/localhost:8080\/xttblog\/test.action<br \/>\n\tStruts2\u5728\u6839\u636eURL\u8fdb\u884c\u5bfb\u5740\u7684\u65f6\u5019\uff0c\u4f7f\u7528\u4ee5\u4e0b\u7684\u6b65\u9aa4\uff1a<br \/>\n\t1) \u6839\u636eURL\u8fdb\u884cNamespace\u548cActionName\u7684\u8ba1\u7b97<br \/>\n\t2) \u6839\u636e\u8ba1\u7b97\u7684\u5f97\u5230\u7684Namespace\u548cActionName\u67e5\u627epackage\u8282\u70b9\u4e2d\u76f8\u5e94\u914d\u7f6e<br \/>\n\t3) \u5982\u679c\u67e5\u627e\u5931\u8d25\uff0c\u5219\u67e5\u627eNamespace\u4e3a\u7a7a\uff0cActionName\u4e3a\u6574\u4e2aURL\u7684\u914d\u7f6e<br \/>\n\t<span style=\"color:red;font-weight:bold\">\u5176\u4ed6\u5e38\u89c1\u914d\u7f6e\uff1a<\/span><br \/>\n\t&lt;constant name=&quot;struts.multipart.maxSize&quot; value=&quot;102400000000&quot; \/&gt; \u73b0\u5728\u4e0a\u4f20\u6587\u4ef6\u5927\u5c0f<br \/>\n\t&lt;constant name=&quot;struts.action.excludePattern&quot; value=&quot;\/xttblog&quot;\/&gt; \u6392\u9664\u6307\u5b9a\u8def\u5f84\u7684\u8fc7\u6ee4\u8bf7\u6c42<br \/>\n\t&lt;constant name=&quot;struts.i18n.encoding&quot; value=&quot;UTF-8&quot;\/&gt; \u6307\u5b9aweb\u5e94\u7528\u9ed8\u8ba4\u7f16\u7801\u96c6<br \/>\n\t&lt;constant name=&rdquo;struts.action.extension&rdquo; value=&rdquo;do&rdquo;\/&gt; \u6307\u5b9a\u9700\u8981struts2\u5904\u7406\u8bf7\u6c42\u540e\u7f00 <\/span><\/p>\n<!-- <audio autoplay=\"autoplay\" height=\"100\" width=\"100\" hidden=\"true\"><source src=\"https:\/\/c.coka.la\/orAvPR.mp3\" type=\"audio\/mp3\"\/><\/audio><img decoding=\"async\" src=\"https:\/\/images.weserv.nl\/?url=https:\/\/ws3.sinaimg.cn\/large\/8fa5dcfcgy1g4em3rzar5j20ib089ae0.jpg\" alt=\"\u4e1a\u4f59\u8349\u516c\u4f17\u53f7\"\/> --><p><!-- <img decoding=\"async\" src=\"https:\/\/raw.githubusercontent.com\/xmt1139057136\/xttblog\/master\/8fa5dcfcgy1g4em3rzar5j20ib089ae0.jpg\" alt=\"\u4e1a\u4f59\u8349\u516c\u4f17\u53f7\"\/>--><img decoding=\"async\" src=\"https:\/\/saas.51autoparts.cn\/api\/admin\/sys-file\/oss\/file?fileName=84db51f8561e448f9a4fda2eff0811f9.jpg\" alt=\"\u4e1a\u4f59\u8349\u516c\u4f17\u53f7\"\/><\/p><p>\u6700\u540e\uff0c\u6b22\u8fce\u5173\u6ce8\u6211\u7684\u4e2a\u4eba\u5fae\u4fe1\u516c\u4f17\u53f7\uff1a\u4e1a\u4f59\u8349\uff08yyucao\uff09\uff01<b>\u53ef\u52a0\u4f5c\u8005\u5fae\u4fe1\u53f7\uff1a<font color=\"red\">xttblog2<\/font>\u3002\u5907\u6ce8\uff1a\u201c1\u201d\uff0c\u6dfb\u52a0\u535a\u4e3b\u5fae\u4fe1\u62c9\u4f60\u8fdb\u5fae\u4fe1\u7fa4\u3002\u5907\u6ce8\u9519\u8bef\u4e0d\u4f1a\u540c\u610f\u597d\u53cb\u7533\u8bf7\u3002<\/b>\u518d\u6b21\u611f\u8c22\u60a8\u7684\u5173\u6ce8\uff01\u540e\u7eed\u6709\u7cbe\u5f69\u5185\u5bb9\u4f1a\u7b2c\u4e00\u65f6\u95f4\u53d1\u7ed9\u60a8\uff01\u539f\u521b\u6587\u7ae0\u6295\u7a3f\u8bf7\u53d1\u9001\u81f3532009913@qq.com\u90ae\u7bb1\u3002\u5546\u52a1\u5408\u4f5c\u4e5f\u53ef\u6dfb\u52a0\u4f5c\u8005\u5fae\u4fe1\u8fdb\u884c\u8054\u7cfb\uff01<\/p><p>\u672c\u6587\u539f\u6587\u51fa\u5904\uff1a<a href=\"https:\/\/www.xttblog.com\">\u4e1a\u4f59\u8349<\/a>\uff1a &raquo; <a href=\"https:\/\/www.xttblog.com\/?p=310\">Struts2 package\u5c5e\u6027\u914d\u7f6e\u8be6\u89e3<\/a><\/p><!-- <div class=\"bd-reward-stl\"><button id=\"bdRewardBtn\"><span><\/span><\/button><\/div> -->","protected":false},"excerpt":{"rendered":"<p>\u73b0\u5728\u7684\u7a0b\u5e8f\u5458\u90fd\u88ab\u6846\u67b6\u7ed9\u6bd2\u5bb3\u4e86\u3002\u4ec0\u4e48Spring\uff0cStruts2\u7b49\u6846\u67b6\u7684\u6a2a\u7a7a\u51fa\u4e16\uff0c\u8ba9\u7a0b\u5e8f\u5458\u66f4\u5173\u6ce8\u4e1a\u52a1\uff0c\u800c\u975e\u67b6\u6784\u3002 [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":311,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[102,100,99,101],"class_list":["post-310","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-java","tag-action","tag-excludepattern","tag-struts2"],"_links":{"self":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts\/310","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=310"}],"version-history":[{"count":2,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts\/310\/revisions"}],"predecessor-version":[{"id":313,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts\/310\/revisions\/313"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/media\/311"}],"wp:attachment":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=310"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=310"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=310"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}