﻿{"id":92,"date":"2013-07-14T12:04:08","date_gmt":"2013-07-14T04:04:08","guid":{"rendered":"http:\/\/blog.sway.com.cn\/?p=92"},"modified":"2013-07-24T22:16:27","modified_gmt":"2013-07-24T14:16:27","slug":"%e8%a7%a3%e5%86%b3struts2%e4%b8%ad%e9%a6%96%e9%a1%b5%e9%bb%98%e8%ae%a4%e8%b0%83%e7%94%a8index%e7%9a%84%e9%97%ae%e9%a2%98","status":"publish","type":"post","link":"http:\/\/blog.sway.com.cn\/?p=92","title":{"rendered":"\u89e3\u51b3struts2\u4e2d\u9996\u9875\u9ed8\u8ba4\u8c03\u7528index\u7684\u95ee\u9898"},"content":{"rendered":"<p>\u5728struts 2\u4e2d\uff0c\u901a\u8fc7\u5728web-xml\u4e2d\u914d\u7f6ewelcome-file\u6b22\u8fce\u9875\u9762\u6765\u8c03\u7528action\u662f\u65e0\u6548\u7684\u3002<\/p>\n<p>\u4ee5\u524d\u662f\u76f4\u63a5\u5728index.jsp\u4e2d\u52a0\u4e0a\u8fd9\u4e2a\u6807\u7b7e\u00a0&lt;s:action name=&#8221;index&#8221; namespace=&#8221;\/&#8221;\/&gt;, \u4f46\u662f\u8fd9\u6837\u505a\u7684\u8bdd, \u5bf9\u5e94index\u7684action\u4e2dresult\u5904\u7406\u5c31\u4e0d\u8d77\u4f5c\u7528\u4e86\u3002<\/p>\n<p>\u7ecf\u8fc7\u8d44\u6599\u6574\u7406\u540e, \u6700\u7ec8\u5f97\u51fa\u6211\u4eec\u53ef\u4ee5\u5728struts-xml\u4e2d\u7684action\u914d\u7f6e\u4e2d\u52a0\u5165\u6765\u5b9e\u73b0\u4f60\u9884\u671f\u7684\u6548\u679c\u3002<\/p>\n<p>\u6211\u4eec\u53ef\u4ee5\u5728\u9ed8\u8ba4\u7684package\u4e2d\u52a0\u4e0a&lt;default-action-ref name=&#8221;action\u540d\u79f0&#8221;\/&gt;, \u5982:<\/p>\n<pre class=\"lang:xhtml mark:2 decode:true\">&lt;package name=\"default\" namespace=\"\/\" extends=\"struts-default\"&gt;\r\n    &lt;default-action-ref name=\"index\"\/&gt;\r\n    &lt;action name=\"index\" class=\"web.action.IndexAction\" method=\"index\"&gt;\r\n        &lt;result name=\"success\"&gt;index.jsp&lt;\/result&gt;\r\n    &lt;\/action&gt;\r\n&lt;\/package&gt;<\/pre>\n<p>\u8fd8\u6709\u4e00\u70b9\u4e0d\u8981\u6f0f\u6389\uff0c\u8bb0\u5f97\u6e05\u7a7aweb.xml\u4e2d\u7684welcome-file\uff0c\u4e0d\u7136\u9ed8\u8ba4\u662f\u4f1a\u88ab\u8c03\u7528index.jsp\u7684\uff0c\u5bf9\u4e8e\u67d0\u4e9b\u4eba\u6765\u8bf4\u53ef\u80fd\u4f1a\u9020\u6210\u9519\u8bef\uff1a<\/p>\n<pre class=\"lang:xhtml decode:true\">&lt;welcome-file-list&gt;\r\n    &lt;welcome-file&gt;&lt;\/welcome-file&gt;\r\n&lt;\/welcome-file-list&gt;<\/pre>\n<p>\u8fd9\u6837\u5373\u53ef\u89e3\u51b3\u8fd9\u4e2a\u95ee\u9898\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5728struts 2\u4e2d\uff0c\u901a\u8fc7\u5728web-xml\u4e2d\u914d\u7f6ewelcome-file\u6b22\u8fce\u9875\u9762 &hellip; <a href=\"http:\/\/blog.sway.com.cn\/?p=92\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[15],"tags":[65,64,18,63],"class_list":["post-92","post","type-post","status-publish","format-standard","hentry","category-struts2","tag-action","tag-index","tag-struts2-2","tag-63"],"_links":{"self":[{"href":"http:\/\/blog.sway.com.cn\/index.php?rest_route=\/wp\/v2\/posts\/92","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/blog.sway.com.cn\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/blog.sway.com.cn\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/blog.sway.com.cn\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/blog.sway.com.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=92"}],"version-history":[{"count":7,"href":"http:\/\/blog.sway.com.cn\/index.php?rest_route=\/wp\/v2\/posts\/92\/revisions"}],"predecessor-version":[{"id":94,"href":"http:\/\/blog.sway.com.cn\/index.php?rest_route=\/wp\/v2\/posts\/92\/revisions\/94"}],"wp:attachment":[{"href":"http:\/\/blog.sway.com.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=92"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/blog.sway.com.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=92"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/blog.sway.com.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=92"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}