{"id":43,"date":"2008-03-17T00:56:23","date_gmt":"2008-03-16T16:56:23","guid":{"rendered":"http:\/\/amjet.dyndns.biz\/blog\/IT\/?p=43"},"modified":"2013-03-01T19:50:31","modified_gmt":"2013-03-01T11:50:31","slug":"struts2-orgapachestruts2servletactioncontext-api-%e7%9a%84-method-%e7%84%a1%e6%b3%95%e4%bd%bf%e7%94%a8","status":"publish","type":"post","link":"https:\/\/blog.amjet.biz\/IT\/?p=43","title":{"rendered":"Struts2 org.apache.struts2.ServletActionContext API \u7684 method \u7121\u6cd5\u4f7f\u7528"},"content":{"rendered":"<p>\u60f3\u8981\u5beb\u500b\u4e0a\u50b3\u6a94\u6848\u7684\u7a0b\u5f0f\uff0c\u7167\u6163\u4f8b\u7528 ServletActionContext \u7684 getServletContext().getRealPath() \u4f86\u53d6\u5f97\u5be6\u969b\u8def\u5f91\uff0c\u4f46\u662f\u9019\u500b\u5217\u5728 API \u7684 method \u537b\u6c92\u6709\u51fa\u73fe\u5728 eclipse \u7684 \u6e05\u55ae\u4e2d\uff0c\u7db2\u8def\u4e0a\u4e5f\u627e\u4e0d\u5230\u89e3\u6c7a\u65b9\u6cd5\uff0c\u6700\u5f8c\u767c\u73fe\u662f\u5c11\u4e86 servlet API \u7684 package\u3002\u9019\u500b package \u5982\u679c\u662f\u7528 tomcat \u7684\u8a71\uff0c\u5df2\u7d93 bundle \u4e86\uff0c\u4e0d\u540c tomcat \u7248\u672c\u5728\u4e0d\u540c\u4f4d\u7f6e\uff1a<\/p>\n<p>&lt;tomcat 5.x&gt;\/common\/lib\/servlet-api.jar<\/p>\n<p>&lt;tomcat 6.x&gt;\/lib\/servlet-api.jar<\/p>\n<p>\u628a servlet-api.jar \u8907\u88fd\u5230 web application \u7684 WEB-INF\/lib \u76ee\u9304\u4e0b\uff0c\u518d\u91cd\u65b0 build\u00a0 project\u00a0 \u5373\u53ef\u3002<\/p>\n<p>\u8a3b1\uff1a\u9019\u500b jar \u6a94\u53ea\u6709\u958b\u767c\u6642\u9700\u8981\uff0cdeploy \u6642\u56e0\u70ba tomcat \u5df2\u7d93 bundle \u4e86\uff0c\u53ef\u4ee5\u4e0d\u8981<\/p>\n<p>\u8a3b2\uff1a\u5982\u679c\u662f\u7528 myeclipse\uff0cIDE \u5728\u5efa\u65b0 web application project \u6642\u6703\u81ea\u52d5\u8655\u7406\u597d\uff0c\u4e0d\u6703\u6709\u9019\u500b\u554f\u984c\uff0c\u4ed8\u4e86\u8cbb\u5e6b\u5fd9\u7701\u4e0b\u4e00\u4e9b\u6642\u9593\u662f\u4e00\u5b9a\u8981\u7684\u5566<\/p>\n<p><strong>[ratings]<\/strong><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u60f3\u8981\u5beb\u500b\u4e0a\u50b3\u6a94\u6848\u7684\u7a0b\u5f0f\uff0c\u7167\u6163\u4f8b\u7528 ServletActionContext \u7684 getServletContext().getRealPath() \u4f86\u53d6\u5f97\u5be6\u969b\u8def\u5f91\uff0c\u4f46\u662f\u9019\u500b\u5217\u5728 API \u7684 method \u537b\u6c92\u6709\u51fa\u73fe\u5728 eclipse \u7684 \u6e05\u55ae\u4e2d\uff0c\u7db2\u8def\u4e0a\u4e5f\u627e\u4e0d\u5230\u89e3\u6c7a\u65b9\u6cd5\uff0c\u6700\u5f8c\u767c\u73fe\u662f\u5c11\u4e86 servlet API \u7684 package\u3002\u9019\u500b package \u5982\u679c\u662f\u7528 tomcat \u7684\u8a71\uff0c\u5df2\u7d93 bundle \u4e86\uff0c\u4e0d\u540c tomcat \u7248\u672c\u5728\u4e0d\u540c\u4f4d\u7f6e\uff1a &lt;tomcat 5.x&gt;\/common\/lib\/servlet-api.jar &lt;tomcat 6.x&gt;\/lib\/servlet-api.jar \u628a servlet-api.jar \u8907\u88fd\u5230 web application \u7684 WEB-INF\/lib \u76ee\u9304\u4e0b\uff0c\u518d\u91cd\u65b0 build\u00a0 project\u00a0 \u5373\u53ef\u3002 \u8a3b1\uff1a\u9019\u500b jar \u6a94\u53ea\u6709\u958b\u767c\u6642\u9700\u8981\uff0cdeploy \u6642\u56e0\u70ba tomcat \u5df2\u7d93 bundle \u4e86\uff0c\u53ef\u4ee5\u4e0d\u8981 \u8a3b2\uff1a\u5982\u679c\u662f\u7528 myeclipse\uff0cIDE \u5728\u5efa\u65b0 web application project \u6642\u6703\u81ea\u52d5\u8655\u7406\u597d\uff0c\u4e0d\u6703\u6709\u9019\u500b\u554f\u984c\uff0c\u4ed8\u4e86\u8cbb\u5e6b\u5fd9\u7701\u4e0b\u4e00\u4e9b\u6642\u9593\u662f\u4e00\u5b9a\u8981\u7684\u5566 [ratings]<\/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":[33],"class_list":["post-43","post","type-post","status-publish","format-standard","hentry","category-java","tag-struts2"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/blog.amjet.biz\/IT\/index.php?rest_route=\/wp\/v2\/posts\/43","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=43"}],"version-history":[{"count":4,"href":"https:\/\/blog.amjet.biz\/IT\/index.php?rest_route=\/wp\/v2\/posts\/43\/revisions"}],"predecessor-version":[{"id":728,"href":"https:\/\/blog.amjet.biz\/IT\/index.php?rest_route=\/wp\/v2\/posts\/43\/revisions\/728"}],"wp:attachment":[{"href":"https:\/\/blog.amjet.biz\/IT\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=43"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.amjet.biz\/IT\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=43"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.amjet.biz\/IT\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=43"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}