{"id":768,"date":"2013-03-07T19:37:27","date_gmt":"2013-03-07T11:37:27","guid":{"rendered":"http:\/\/blog.amjet.cc\/IT\/?p=768"},"modified":"2014-10-23T10:12:26","modified_gmt":"2014-10-23T02:12:26","slug":"struts2-tips","status":"publish","type":"post","link":"https:\/\/blog.amjet.biz\/IT\/?p=768","title":{"rendered":"Struts2 tips"},"content":{"rendered":"<p>\u7576 struts2 \u7684 action code \u62cb\u51fa exception \u6642\uff0c\u6709\u4e00\u500b\u9801\u9762\u63d0\u793a\u7cfb\u7d71\u7684\u4f7f\u7528\u8005\u662f\u76f8\u7576\u65b9\u4fbf\u7684\uff0c\u4e00\u65b9\u9762\u8b93\u4f7f\u7528\u8005\u4e86\u89e3\u76ee\u524d\u767c\u751f\u4e86\u7570\u5e38\u7684\u60c5\u5f62\uff0c\u4e5f\u53ef\u4ee5\u5728\u9801\u9762\u4e0a\u7f6e\u5165\u932f\u8aa4\u78bc\u8b93\u554f\u984c\u56de\u5831\u53ca\u89e3\u6c7a\u66f4\u52a0\u6709\u6548\u7387\u3002\u672c\u6587\u4e3b\u8981\u53c3\u8003\u9019\u500b <a href=\"http:\/\/struts.apache.org\/release\/2.0.x\/docs\/exception-configuration.html\" target=\"_blank\">\u7db2\u5740<\/a><\/p>\n<p>\u9996\u5148\u5728 struts.xml \u8981\u6709\u4ee5\u4e0b\u8a2d\u5b9a<\/p>\n<p>&lt;global-results&gt;<br \/>\n&lt;result name=&#8221;Exception&#8221;&gt;\/Exception.jsp&lt;\/result&gt;<br \/>\n&lt;\/global-results&gt;<br \/>\n&lt;global-exception-mappings&gt;<br \/>\n&lt;exception-mapping exception=&#8221;java.lang.Exception&#8221; result=&#8221;Exception&#8221;\/&gt;<br \/>\n&lt;\/global-exception-mappings&gt;<\/p>\n<p>\u5728 jsp \u53ef\u4ee5\u986f\u793a &#8216;\u76ee\u524d\u7cfb\u7d71\u767c\u751f\u7570\u5e38\u72c0\u6cc1\uff0c\u932f\u8aa4\u4ee3\u78bc\u70ba xxxxxx\u00a0\uff0c\u8acb\u5411\u7cfb\u7d71\u7ba1\u7406\u4eba\u54e1\u56de\u5831\u4ee5\u4fbf\u5118\u5feb\u8655\u7406&#8217; \u3002<\/p>\n<p>\u53e6\u5916\u5728 jsp \u7684 OGNL \u8a9e\u6cd5\u5b57\u4e32\u6bd4\u8f03\u90e8\u4efd\u6709\u4e00\u500b\u5c0f\u63d0\u793a<\/p>\n<p>&lt;s:if test=&#8221;%{#request.err_code.equals(&#8216;A&#8217;)&#8221;&gt;<\/p>\n<p>\u9019\u500b\u5beb\u6cd5 err_code \u662f\u5b57\u4e32\uff0c&#8217;A&#8217; \u662f\u4e00\u500b character\uff0c\u6240\u4ee5\u5373\u4f7f action err_code \u50b3\u4f86 &#8220;A&#8221;\uff0c\u6bd4\u5c0d\u7684\u7d50\u679c\u4ecd\u7136\u662f false<\/p>\n<p>&lt;s:if test=&#8217;%{#request.err_code.equals(&#8220;A&#8221;)&#8217;&gt;<\/p>\n<p>\u4ee5\u4e0a\u7684\u5beb\u6cd5\u6bd4\u5c0d\u7684\u7d50\u679c\u624d\u6703\u662f true<\/p>\n<p>&nbsp;<\/p>\n<p>[ratings]<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u7576 struts2 \u7684 action code \u62cb\u51fa exception \u6642\uff0c\u6709\u4e00\u500b\u9801\u9762\u63d0\u793a\u7cfb\u7d71\u7684\u4f7f\u7528\u8005\u662f\u76f8\u7576\u65b9\u4fbf\u7684\uff0c\u4e00\u65b9\u9762\u8b93\u4f7f\u7528\u8005\u4e86\u89e3\u76ee\u524d\u767c\u751f\u4e86\u7570\u5e38\u7684\u60c5\u5f62\uff0c\u4e5f\u53ef\u4ee5\u5728\u9801\u9762\u4e0a\u7f6e\u5165\u932f\u8aa4\u78bc\u8b93\u554f\u984c\u56de\u5831\u53ca\u89e3\u6c7a\u66f4\u52a0\u6709\u6548\u7387\u3002\u672c\u6587\u4e3b\u8981\u53c3\u8003\u9019\u500b \u7db2\u5740 \u9996\u5148\u5728 struts.xml \u8981\u6709\u4ee5\u4e0b\u8a2d\u5b9a &lt;global-results&gt; &lt;result name=&#8221;Exception&#8221;&gt;\/Exception.jsp&lt;\/result&gt; &lt;\/global-results&gt; &lt;global-exception-mappings&gt; &lt;exception-mapping exception=&#8221;java.lang.Exception&#8221; result=&#8221;Exception&#8221;\/&gt; &lt;\/global-exception-mappings&gt; \u5728 jsp \u53ef\u4ee5\u986f\u793a &#8216;\u76ee\u524d\u7cfb\u7d71\u767c\u751f\u7570\u5e38\u72c0\u6cc1\uff0c\u932f\u8aa4\u4ee3\u78bc\u70ba xxxxxx\u00a0\uff0c\u8acb\u5411\u7cfb\u7d71\u7ba1\u7406\u4eba\u54e1\u56de\u5831\u4ee5\u4fbf\u5118\u5feb\u8655\u7406&#8217; \u3002 \u53e6\u5916\u5728 jsp \u7684 OGNL \u8a9e\u6cd5\u5b57\u4e32\u6bd4\u8f03\u90e8\u4efd\u6709\u4e00\u500b\u5c0f\u63d0\u793a &lt;s:if test=&#8221;%{#request.err_code.equals(&#8216;A&#8217;)&#8221;&gt; \u9019\u500b\u5beb\u6cd5 err_code \u662f\u5b57\u4e32\uff0c&#8217;A&#8217; \u662f\u4e00\u500b character\uff0c\u6240\u4ee5\u5373\u4f7f action err_code \u50b3\u4f86 &#8220;A&#8221;\uff0c\u6bd4\u5c0d\u7684\u7d50\u679c\u4ecd\u7136\u662f false &lt;s:if test=&#8217;%{#request.err_code.equals(&#8220;A&#8221;)&#8217;&gt; \u4ee5\u4e0a\u7684\u5beb\u6cd5\u6bd4\u5c0d\u7684\u7d50\u679c\u624d\u6703\u662f true &nbsp; [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":[121,33],"class_list":["post-768","post","type-post","status-publish","format-standard","hentry","category-java","tag-exception","tag-struts2"],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 4.9.10 - aioseo.com -->\n\t<meta name=\"description\" content=\"\u7576 struts2 \u7684 action code \u62cb\u51fa exception \u6642\uff0c\u6709\u4e00\u500b\u9801\u9762\u63d0\u793a\u7cfb\u7d71\u7684\u4f7f\u7528\u8005\u662f\u76f8\u7576\u65b9\u4fbf\u7684\uff0c\u4e00\u65b9\u9762\u8b93\u4f7f\u7528\u8005\u4e86\u89e3\u76ee\u524d\u767c\u751f\u4e86\u7570\u5e38\u7684\u60c5\u5f62\uff0c\u4e5f\u53ef\u4ee5\u5728\u9801\u9762\u4e0a\u7f6e\u5165\u932f\u8aa4\u78bc\u8b93\u554f\u984c\u56de\u5831\u53ca\u89e3\u6c7a\u66f4\u52a0\u6709\u6548\u7387\u3002\u672c\u6587\u4e3b\u8981\u53c3\u8003\u9019\u500b \u7db2\u5740 \u9996\u5148\u5728 struts.xml \u8981\u6709\u4ee5\u4e0b\u8a2d\u5b9a \/Exception.jsp \u5728 jsp \u53ef\u4ee5\u986f\u793a &#039;\u76ee\u524d\u7cfb\u7d71\u767c\u751f\u7570\u5e38\u72c0\u6cc1\uff0c\u932f\u8aa4\u4ee3\u78bc\u70ba xxxxxx \uff0c\u8acb\u5411\u7cfb\u7d71\u7ba1\u7406\u4eba\u54e1\u56de\u5831\u4ee5\u4fbf\u5118\u5feb\u8655\u7406&#039; \u3002 \u53e6\u5916\u5728 jsp \u7684 OGNL \u8a9e\u6cd5\u5b57\u4e32\u6bd4\u8f03\u90e8\u4efd\u6709\u4e00\u500b\u5c0f\u63d0\u793a \u9019\u500b\u5beb\u6cd5 err_code \u662f\u5b57\u4e32\uff0c&#039;A&#039; \u662f\u4e00\u500b character\uff0c\u6240\u4ee5\u5373\u4f7f action err_code \u50b3\u4f86 &quot;A&quot;\uff0c\u6bd4\u5c0d\u7684\u7d50\u679c\u4ecd\u7136\u662f false \u4ee5\u4e0a\u7684\u5beb\u6cd5\u6bd4\u5c0d\u7684\u7d50\u679c\u624d\u6703\u662f true [ratings]\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"vincent\"\/>\n\t<meta name=\"keywords\" content=\"struts2,exception,exception,struts2\" \/>\n\t<link rel=\"canonical\" href=\"https:\/\/blog.amjet.biz\/IT\/?p=768\" \/>\n\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 4.9.10\" \/>\n\t\t<meta property=\"og:locale\" content=\"en_US\" \/>\n\t\t<meta property=\"og:site_name\" content=\"AmJet IT Blog | for IT professionals\" \/>\n\t\t<meta property=\"og:type\" content=\"article\" \/>\n\t\t<meta property=\"og:title\" content=\"Struts2 tips | AmJet IT Blog\" \/>\n\t\t<meta property=\"og:description\" content=\"\u7576 struts2 \u7684 action code \u62cb\u51fa exception \u6642\uff0c\u6709\u4e00\u500b\u9801\u9762\u63d0\u793a\u7cfb\u7d71\u7684\u4f7f\u7528\u8005\u662f\u76f8\u7576\u65b9\u4fbf\u7684\uff0c\u4e00\u65b9\u9762\u8b93\u4f7f\u7528\u8005\u4e86\u89e3\u76ee\u524d\u767c\u751f\u4e86\u7570\u5e38\u7684\u60c5\u5f62\uff0c\u4e5f\u53ef\u4ee5\u5728\u9801\u9762\u4e0a\u7f6e\u5165\u932f\u8aa4\u78bc\u8b93\u554f\u984c\u56de\u5831\u53ca\u89e3\u6c7a\u66f4\u52a0\u6709\u6548\u7387\u3002\u672c\u6587\u4e3b\u8981\u53c3\u8003\u9019\u500b \u7db2\u5740 \u9996\u5148\u5728 struts.xml \u8981\u6709\u4ee5\u4e0b\u8a2d\u5b9a \/Exception.jsp \u5728 jsp \u53ef\u4ee5\u986f\u793a &#039;\u76ee\u524d\u7cfb\u7d71\u767c\u751f\u7570\u5e38\u72c0\u6cc1\uff0c\u932f\u8aa4\u4ee3\u78bc\u70ba xxxxxx \uff0c\u8acb\u5411\u7cfb\u7d71\u7ba1\u7406\u4eba\u54e1\u56de\u5831\u4ee5\u4fbf\u5118\u5feb\u8655\u7406&#039; \u3002 \u53e6\u5916\u5728 jsp \u7684 OGNL \u8a9e\u6cd5\u5b57\u4e32\u6bd4\u8f03\u90e8\u4efd\u6709\u4e00\u500b\u5c0f\u63d0\u793a \u9019\u500b\u5beb\u6cd5 err_code \u662f\u5b57\u4e32\uff0c&#039;A&#039; \u662f\u4e00\u500b character\uff0c\u6240\u4ee5\u5373\u4f7f action err_code \u50b3\u4f86 &quot;A&quot;\uff0c\u6bd4\u5c0d\u7684\u7d50\u679c\u4ecd\u7136\u662f false \u4ee5\u4e0a\u7684\u5beb\u6cd5\u6bd4\u5c0d\u7684\u7d50\u679c\u624d\u6703\u662f true [ratings]\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/blog.amjet.biz\/IT\/?p=768\" \/>\n\t\t<meta property=\"article:published_time\" content=\"2013-03-07T11:37:27+00:00\" \/>\n\t\t<meta property=\"article:modified_time\" content=\"2014-10-23T02:12:26+00:00\" \/>\n\t\t<meta name=\"twitter:card\" content=\"summary\" \/>\n\t\t<meta name=\"twitter:title\" content=\"Struts2 tips | AmJet IT Blog\" \/>\n\t\t<meta name=\"twitter:description\" content=\"\u7576 struts2 \u7684 action code \u62cb\u51fa exception \u6642\uff0c\u6709\u4e00\u500b\u9801\u9762\u63d0\u793a\u7cfb\u7d71\u7684\u4f7f\u7528\u8005\u662f\u76f8\u7576\u65b9\u4fbf\u7684\uff0c\u4e00\u65b9\u9762\u8b93\u4f7f\u7528\u8005\u4e86\u89e3\u76ee\u524d\u767c\u751f\u4e86\u7570\u5e38\u7684\u60c5\u5f62\uff0c\u4e5f\u53ef\u4ee5\u5728\u9801\u9762\u4e0a\u7f6e\u5165\u932f\u8aa4\u78bc\u8b93\u554f\u984c\u56de\u5831\u53ca\u89e3\u6c7a\u66f4\u52a0\u6709\u6548\u7387\u3002\u672c\u6587\u4e3b\u8981\u53c3\u8003\u9019\u500b \u7db2\u5740 \u9996\u5148\u5728 struts.xml \u8981\u6709\u4ee5\u4e0b\u8a2d\u5b9a \/Exception.jsp \u5728 jsp \u53ef\u4ee5\u986f\u793a &#039;\u76ee\u524d\u7cfb\u7d71\u767c\u751f\u7570\u5e38\u72c0\u6cc1\uff0c\u932f\u8aa4\u4ee3\u78bc\u70ba xxxxxx \uff0c\u8acb\u5411\u7cfb\u7d71\u7ba1\u7406\u4eba\u54e1\u56de\u5831\u4ee5\u4fbf\u5118\u5feb\u8655\u7406&#039; \u3002 \u53e6\u5916\u5728 jsp \u7684 OGNL \u8a9e\u6cd5\u5b57\u4e32\u6bd4\u8f03\u90e8\u4efd\u6709\u4e00\u500b\u5c0f\u63d0\u793a \u9019\u500b\u5beb\u6cd5 err_code \u662f\u5b57\u4e32\uff0c&#039;A&#039; \u662f\u4e00\u500b character\uff0c\u6240\u4ee5\u5373\u4f7f action err_code \u50b3\u4f86 &quot;A&quot;\uff0c\u6bd4\u5c0d\u7684\u7d50\u679c\u4ecd\u7136\u662f false \u4ee5\u4e0a\u7684\u5beb\u6cd5\u6bd4\u5c0d\u7684\u7d50\u679c\u624d\u6703\u662f true [ratings]\" \/>\n\t\t<script type=\"application\/ld+json\" class=\"aioseo-schema\">\n\t\t\t{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/blog.amjet.biz\\\/IT\\\/?p=768#article\",\"name\":\"Struts2 tips | AmJet IT Blog\",\"headline\":\"Struts2 tips\",\"author\":{\"@id\":\"https:\\\/\\\/blog.amjet.biz\\\/IT\\\/?author=2#author\"},\"publisher\":{\"@id\":\"https:\\\/\\\/blog.amjet.biz\\\/IT\\\/#organization\"},\"datePublished\":\"2013-03-07T19:37:27+08:00\",\"dateModified\":\"2014-10-23T10:12:26+08:00\",\"inLanguage\":\"en-US\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/blog.amjet.biz\\\/IT\\\/?p=768#webpage\"},\"isPartOf\":{\"@id\":\"https:\\\/\\\/blog.amjet.biz\\\/IT\\\/?p=768#webpage\"},\"articleSection\":\"Java, Exception, Struts2\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/blog.amjet.biz\\\/IT\\\/?p=768#breadcrumblist\",\"itemListElement\":[{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/blog.amjet.biz\\\/IT#listItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/blog.amjet.biz\\\/IT\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/blog.amjet.biz\\\/IT\\\/?cat=5#listItem\",\"name\":\"Developer\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/blog.amjet.biz\\\/IT\\\/?cat=5#listItem\",\"position\":2,\"name\":\"Developer\",\"item\":\"https:\\\/\\\/blog.amjet.biz\\\/IT\\\/?cat=5\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/blog.amjet.biz\\\/IT\\\/?cat=8#listItem\",\"name\":\"Java\"},\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/blog.amjet.biz\\\/IT#listItem\",\"name\":\"Home\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/blog.amjet.biz\\\/IT\\\/?cat=8#listItem\",\"position\":3,\"name\":\"Java\",\"item\":\"https:\\\/\\\/blog.amjet.biz\\\/IT\\\/?cat=8\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/blog.amjet.biz\\\/IT\\\/?p=768#listItem\",\"name\":\"Struts2 tips\"},\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/blog.amjet.biz\\\/IT\\\/?cat=5#listItem\",\"name\":\"Developer\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/blog.amjet.biz\\\/IT\\\/?p=768#listItem\",\"position\":4,\"name\":\"Struts2 tips\",\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/blog.amjet.biz\\\/IT\\\/?cat=8#listItem\",\"name\":\"Java\"}}]},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/blog.amjet.biz\\\/IT\\\/#organization\",\"name\":\"AmJet Digital\",\"description\":\"for IT professionals\",\"url\":\"https:\\\/\\\/blog.amjet.biz\\\/IT\\\/\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/blog.amjet.biz\\\/IT\\\/?author=2#author\",\"url\":\"https:\\\/\\\/blog.amjet.biz\\\/IT\\\/?author=2\",\"name\":\"vincent\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\\\/\\\/blog.amjet.biz\\\/IT\\\/?p=768#authorImage\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/8c6bcd6e8e7e1c9bce74184354da4a5c294d71657c7abc161841c4799d1b1a46?s=96&d=mm&r=g\",\"width\":96,\"height\":96,\"caption\":\"vincent\"}},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/blog.amjet.biz\\\/IT\\\/?p=768#webpage\",\"url\":\"https:\\\/\\\/blog.amjet.biz\\\/IT\\\/?p=768\",\"name\":\"Struts2 tips | AmJet IT Blog\",\"description\":\"\\u7576 struts2 \\u7684 action code \\u62cb\\u51fa exception \\u6642\\uff0c\\u6709\\u4e00\\u500b\\u9801\\u9762\\u63d0\\u793a\\u7cfb\\u7d71\\u7684\\u4f7f\\u7528\\u8005\\u662f\\u76f8\\u7576\\u65b9\\u4fbf\\u7684\\uff0c\\u4e00\\u65b9\\u9762\\u8b93\\u4f7f\\u7528\\u8005\\u4e86\\u89e3\\u76ee\\u524d\\u767c\\u751f\\u4e86\\u7570\\u5e38\\u7684\\u60c5\\u5f62\\uff0c\\u4e5f\\u53ef\\u4ee5\\u5728\\u9801\\u9762\\u4e0a\\u7f6e\\u5165\\u932f\\u8aa4\\u78bc\\u8b93\\u554f\\u984c\\u56de\\u5831\\u53ca\\u89e3\\u6c7a\\u66f4\\u52a0\\u6709\\u6548\\u7387\\u3002\\u672c\\u6587\\u4e3b\\u8981\\u53c3\\u8003\\u9019\\u500b \\u7db2\\u5740 \\u9996\\u5148\\u5728 struts.xml \\u8981\\u6709\\u4ee5\\u4e0b\\u8a2d\\u5b9a \\\/Exception.jsp \\u5728 jsp \\u53ef\\u4ee5\\u986f\\u793a '\\u76ee\\u524d\\u7cfb\\u7d71\\u767c\\u751f\\u7570\\u5e38\\u72c0\\u6cc1\\uff0c\\u932f\\u8aa4\\u4ee3\\u78bc\\u70ba xxxxxx \\uff0c\\u8acb\\u5411\\u7cfb\\u7d71\\u7ba1\\u7406\\u4eba\\u54e1\\u56de\\u5831\\u4ee5\\u4fbf\\u5118\\u5feb\\u8655\\u7406' \\u3002 \\u53e6\\u5916\\u5728 jsp \\u7684 OGNL \\u8a9e\\u6cd5\\u5b57\\u4e32\\u6bd4\\u8f03\\u90e8\\u4efd\\u6709\\u4e00\\u500b\\u5c0f\\u63d0\\u793a \\u9019\\u500b\\u5beb\\u6cd5 err_code \\u662f\\u5b57\\u4e32\\uff0c'A' \\u662f\\u4e00\\u500b character\\uff0c\\u6240\\u4ee5\\u5373\\u4f7f action err_code \\u50b3\\u4f86 \\\"A\\\"\\uff0c\\u6bd4\\u5c0d\\u7684\\u7d50\\u679c\\u4ecd\\u7136\\u662f false \\u4ee5\\u4e0a\\u7684\\u5beb\\u6cd5\\u6bd4\\u5c0d\\u7684\\u7d50\\u679c\\u624d\\u6703\\u662f true [ratings]\",\"inLanguage\":\"en-US\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/blog.amjet.biz\\\/IT\\\/#website\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/blog.amjet.biz\\\/IT\\\/?p=768#breadcrumblist\"},\"author\":{\"@id\":\"https:\\\/\\\/blog.amjet.biz\\\/IT\\\/?author=2#author\"},\"creator\":{\"@id\":\"https:\\\/\\\/blog.amjet.biz\\\/IT\\\/?author=2#author\"},\"datePublished\":\"2013-03-07T19:37:27+08:00\",\"dateModified\":\"2014-10-23T10:12:26+08:00\"},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/blog.amjet.biz\\\/IT\\\/#website\",\"url\":\"https:\\\/\\\/blog.amjet.biz\\\/IT\\\/\",\"name\":\"AmJet IT Blog\",\"description\":\"for IT professionals\",\"inLanguage\":\"en-US\",\"publisher\":{\"@id\":\"https:\\\/\\\/blog.amjet.biz\\\/IT\\\/#organization\"}}]}\n\t\t<\/script>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"Struts2 tips | AmJet IT Blog","description":"\u7576 struts2 \u7684 action code \u62cb\u51fa exception \u6642\uff0c\u6709\u4e00\u500b\u9801\u9762\u63d0\u793a\u7cfb\u7d71\u7684\u4f7f\u7528\u8005\u662f\u76f8\u7576\u65b9\u4fbf\u7684\uff0c\u4e00\u65b9\u9762\u8b93\u4f7f\u7528\u8005\u4e86\u89e3\u76ee\u524d\u767c\u751f\u4e86\u7570\u5e38\u7684\u60c5\u5f62\uff0c\u4e5f\u53ef\u4ee5\u5728\u9801\u9762\u4e0a\u7f6e\u5165\u932f\u8aa4\u78bc\u8b93\u554f\u984c\u56de\u5831\u53ca\u89e3\u6c7a\u66f4\u52a0\u6709\u6548\u7387\u3002\u672c\u6587\u4e3b\u8981\u53c3\u8003\u9019\u500b \u7db2\u5740 \u9996\u5148\u5728 struts.xml \u8981\u6709\u4ee5\u4e0b\u8a2d\u5b9a \/Exception.jsp \u5728 jsp \u53ef\u4ee5\u986f\u793a '\u76ee\u524d\u7cfb\u7d71\u767c\u751f\u7570\u5e38\u72c0\u6cc1\uff0c\u932f\u8aa4\u4ee3\u78bc\u70ba xxxxxx \uff0c\u8acb\u5411\u7cfb\u7d71\u7ba1\u7406\u4eba\u54e1\u56de\u5831\u4ee5\u4fbf\u5118\u5feb\u8655\u7406' \u3002 \u53e6\u5916\u5728 jsp \u7684 OGNL \u8a9e\u6cd5\u5b57\u4e32\u6bd4\u8f03\u90e8\u4efd\u6709\u4e00\u500b\u5c0f\u63d0\u793a \u9019\u500b\u5beb\u6cd5 err_code \u662f\u5b57\u4e32\uff0c'A' \u662f\u4e00\u500b character\uff0c\u6240\u4ee5\u5373\u4f7f action err_code \u50b3\u4f86 \"A\"\uff0c\u6bd4\u5c0d\u7684\u7d50\u679c\u4ecd\u7136\u662f false \u4ee5\u4e0a\u7684\u5beb\u6cd5\u6bd4\u5c0d\u7684\u7d50\u679c\u624d\u6703\u662f true [ratings]","canonical_url":"https:\/\/blog.amjet.biz\/IT\/?p=768","robots":"max-image-preview:large","keywords":"struts2,exception,exception,struts2","webmasterTools":{"miscellaneous":""},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/blog.amjet.biz\/IT\/?p=768#article","name":"Struts2 tips | AmJet IT Blog","headline":"Struts2 tips","author":{"@id":"https:\/\/blog.amjet.biz\/IT\/?author=2#author"},"publisher":{"@id":"https:\/\/blog.amjet.biz\/IT\/#organization"},"datePublished":"2013-03-07T19:37:27+08:00","dateModified":"2014-10-23T10:12:26+08:00","inLanguage":"en-US","mainEntityOfPage":{"@id":"https:\/\/blog.amjet.biz\/IT\/?p=768#webpage"},"isPartOf":{"@id":"https:\/\/blog.amjet.biz\/IT\/?p=768#webpage"},"articleSection":"Java, Exception, Struts2"},{"@type":"BreadcrumbList","@id":"https:\/\/blog.amjet.biz\/IT\/?p=768#breadcrumblist","itemListElement":[{"@type":"ListItem","@id":"https:\/\/blog.amjet.biz\/IT#listItem","position":1,"name":"Home","item":"https:\/\/blog.amjet.biz\/IT","nextItem":{"@type":"ListItem","@id":"https:\/\/blog.amjet.biz\/IT\/?cat=5#listItem","name":"Developer"}},{"@type":"ListItem","@id":"https:\/\/blog.amjet.biz\/IT\/?cat=5#listItem","position":2,"name":"Developer","item":"https:\/\/blog.amjet.biz\/IT\/?cat=5","nextItem":{"@type":"ListItem","@id":"https:\/\/blog.amjet.biz\/IT\/?cat=8#listItem","name":"Java"},"previousItem":{"@type":"ListItem","@id":"https:\/\/blog.amjet.biz\/IT#listItem","name":"Home"}},{"@type":"ListItem","@id":"https:\/\/blog.amjet.biz\/IT\/?cat=8#listItem","position":3,"name":"Java","item":"https:\/\/blog.amjet.biz\/IT\/?cat=8","nextItem":{"@type":"ListItem","@id":"https:\/\/blog.amjet.biz\/IT\/?p=768#listItem","name":"Struts2 tips"},"previousItem":{"@type":"ListItem","@id":"https:\/\/blog.amjet.biz\/IT\/?cat=5#listItem","name":"Developer"}},{"@type":"ListItem","@id":"https:\/\/blog.amjet.biz\/IT\/?p=768#listItem","position":4,"name":"Struts2 tips","previousItem":{"@type":"ListItem","@id":"https:\/\/blog.amjet.biz\/IT\/?cat=8#listItem","name":"Java"}}]},{"@type":"Organization","@id":"https:\/\/blog.amjet.biz\/IT\/#organization","name":"AmJet Digital","description":"for IT professionals","url":"https:\/\/blog.amjet.biz\/IT\/"},{"@type":"Person","@id":"https:\/\/blog.amjet.biz\/IT\/?author=2#author","url":"https:\/\/blog.amjet.biz\/IT\/?author=2","name":"vincent","image":{"@type":"ImageObject","@id":"https:\/\/blog.amjet.biz\/IT\/?p=768#authorImage","url":"https:\/\/secure.gravatar.com\/avatar\/8c6bcd6e8e7e1c9bce74184354da4a5c294d71657c7abc161841c4799d1b1a46?s=96&d=mm&r=g","width":96,"height":96,"caption":"vincent"}},{"@type":"WebPage","@id":"https:\/\/blog.amjet.biz\/IT\/?p=768#webpage","url":"https:\/\/blog.amjet.biz\/IT\/?p=768","name":"Struts2 tips | AmJet IT Blog","description":"\u7576 struts2 \u7684 action code \u62cb\u51fa exception \u6642\uff0c\u6709\u4e00\u500b\u9801\u9762\u63d0\u793a\u7cfb\u7d71\u7684\u4f7f\u7528\u8005\u662f\u76f8\u7576\u65b9\u4fbf\u7684\uff0c\u4e00\u65b9\u9762\u8b93\u4f7f\u7528\u8005\u4e86\u89e3\u76ee\u524d\u767c\u751f\u4e86\u7570\u5e38\u7684\u60c5\u5f62\uff0c\u4e5f\u53ef\u4ee5\u5728\u9801\u9762\u4e0a\u7f6e\u5165\u932f\u8aa4\u78bc\u8b93\u554f\u984c\u56de\u5831\u53ca\u89e3\u6c7a\u66f4\u52a0\u6709\u6548\u7387\u3002\u672c\u6587\u4e3b\u8981\u53c3\u8003\u9019\u500b \u7db2\u5740 \u9996\u5148\u5728 struts.xml \u8981\u6709\u4ee5\u4e0b\u8a2d\u5b9a \/Exception.jsp \u5728 jsp \u53ef\u4ee5\u986f\u793a '\u76ee\u524d\u7cfb\u7d71\u767c\u751f\u7570\u5e38\u72c0\u6cc1\uff0c\u932f\u8aa4\u4ee3\u78bc\u70ba xxxxxx \uff0c\u8acb\u5411\u7cfb\u7d71\u7ba1\u7406\u4eba\u54e1\u56de\u5831\u4ee5\u4fbf\u5118\u5feb\u8655\u7406' \u3002 \u53e6\u5916\u5728 jsp \u7684 OGNL \u8a9e\u6cd5\u5b57\u4e32\u6bd4\u8f03\u90e8\u4efd\u6709\u4e00\u500b\u5c0f\u63d0\u793a \u9019\u500b\u5beb\u6cd5 err_code \u662f\u5b57\u4e32\uff0c'A' \u662f\u4e00\u500b character\uff0c\u6240\u4ee5\u5373\u4f7f action err_code \u50b3\u4f86 \"A\"\uff0c\u6bd4\u5c0d\u7684\u7d50\u679c\u4ecd\u7136\u662f false \u4ee5\u4e0a\u7684\u5beb\u6cd5\u6bd4\u5c0d\u7684\u7d50\u679c\u624d\u6703\u662f true [ratings]","inLanguage":"en-US","isPartOf":{"@id":"https:\/\/blog.amjet.biz\/IT\/#website"},"breadcrumb":{"@id":"https:\/\/blog.amjet.biz\/IT\/?p=768#breadcrumblist"},"author":{"@id":"https:\/\/blog.amjet.biz\/IT\/?author=2#author"},"creator":{"@id":"https:\/\/blog.amjet.biz\/IT\/?author=2#author"},"datePublished":"2013-03-07T19:37:27+08:00","dateModified":"2014-10-23T10:12:26+08:00"},{"@type":"WebSite","@id":"https:\/\/blog.amjet.biz\/IT\/#website","url":"https:\/\/blog.amjet.biz\/IT\/","name":"AmJet IT Blog","description":"for IT professionals","inLanguage":"en-US","publisher":{"@id":"https:\/\/blog.amjet.biz\/IT\/#organization"}}]},"og:locale":"en_US","og:site_name":"AmJet IT Blog | for IT professionals","og:type":"article","og:title":"Struts2 tips | AmJet IT Blog","og:description":"\u7576 struts2 \u7684 action code \u62cb\u51fa exception \u6642\uff0c\u6709\u4e00\u500b\u9801\u9762\u63d0\u793a\u7cfb\u7d71\u7684\u4f7f\u7528\u8005\u662f\u76f8\u7576\u65b9\u4fbf\u7684\uff0c\u4e00\u65b9\u9762\u8b93\u4f7f\u7528\u8005\u4e86\u89e3\u76ee\u524d\u767c\u751f\u4e86\u7570\u5e38\u7684\u60c5\u5f62\uff0c\u4e5f\u53ef\u4ee5\u5728\u9801\u9762\u4e0a\u7f6e\u5165\u932f\u8aa4\u78bc\u8b93\u554f\u984c\u56de\u5831\u53ca\u89e3\u6c7a\u66f4\u52a0\u6709\u6548\u7387\u3002\u672c\u6587\u4e3b\u8981\u53c3\u8003\u9019\u500b \u7db2\u5740 \u9996\u5148\u5728 struts.xml \u8981\u6709\u4ee5\u4e0b\u8a2d\u5b9a \/Exception.jsp \u5728 jsp \u53ef\u4ee5\u986f\u793a '\u76ee\u524d\u7cfb\u7d71\u767c\u751f\u7570\u5e38\u72c0\u6cc1\uff0c\u932f\u8aa4\u4ee3\u78bc\u70ba xxxxxx \uff0c\u8acb\u5411\u7cfb\u7d71\u7ba1\u7406\u4eba\u54e1\u56de\u5831\u4ee5\u4fbf\u5118\u5feb\u8655\u7406' \u3002 \u53e6\u5916\u5728 jsp \u7684 OGNL \u8a9e\u6cd5\u5b57\u4e32\u6bd4\u8f03\u90e8\u4efd\u6709\u4e00\u500b\u5c0f\u63d0\u793a \u9019\u500b\u5beb\u6cd5 err_code \u662f\u5b57\u4e32\uff0c'A' \u662f\u4e00\u500b character\uff0c\u6240\u4ee5\u5373\u4f7f action err_code \u50b3\u4f86 &quot;A&quot;\uff0c\u6bd4\u5c0d\u7684\u7d50\u679c\u4ecd\u7136\u662f false \u4ee5\u4e0a\u7684\u5beb\u6cd5\u6bd4\u5c0d\u7684\u7d50\u679c\u624d\u6703\u662f true [ratings]","og:url":"https:\/\/blog.amjet.biz\/IT\/?p=768","article:published_time":"2013-03-07T11:37:27+00:00","article:modified_time":"2014-10-23T02:12:26+00:00","twitter:card":"summary","twitter:title":"Struts2 tips | AmJet IT Blog","twitter:description":"\u7576 struts2 \u7684 action code \u62cb\u51fa exception \u6642\uff0c\u6709\u4e00\u500b\u9801\u9762\u63d0\u793a\u7cfb\u7d71\u7684\u4f7f\u7528\u8005\u662f\u76f8\u7576\u65b9\u4fbf\u7684\uff0c\u4e00\u65b9\u9762\u8b93\u4f7f\u7528\u8005\u4e86\u89e3\u76ee\u524d\u767c\u751f\u4e86\u7570\u5e38\u7684\u60c5\u5f62\uff0c\u4e5f\u53ef\u4ee5\u5728\u9801\u9762\u4e0a\u7f6e\u5165\u932f\u8aa4\u78bc\u8b93\u554f\u984c\u56de\u5831\u53ca\u89e3\u6c7a\u66f4\u52a0\u6709\u6548\u7387\u3002\u672c\u6587\u4e3b\u8981\u53c3\u8003\u9019\u500b \u7db2\u5740 \u9996\u5148\u5728 struts.xml \u8981\u6709\u4ee5\u4e0b\u8a2d\u5b9a \/Exception.jsp \u5728 jsp \u53ef\u4ee5\u986f\u793a '\u76ee\u524d\u7cfb\u7d71\u767c\u751f\u7570\u5e38\u72c0\u6cc1\uff0c\u932f\u8aa4\u4ee3\u78bc\u70ba xxxxxx \uff0c\u8acb\u5411\u7cfb\u7d71\u7ba1\u7406\u4eba\u54e1\u56de\u5831\u4ee5\u4fbf\u5118\u5feb\u8655\u7406' \u3002 \u53e6\u5916\u5728 jsp \u7684 OGNL \u8a9e\u6cd5\u5b57\u4e32\u6bd4\u8f03\u90e8\u4efd\u6709\u4e00\u500b\u5c0f\u63d0\u793a \u9019\u500b\u5beb\u6cd5 err_code \u662f\u5b57\u4e32\uff0c'A' \u662f\u4e00\u500b character\uff0c\u6240\u4ee5\u5373\u4f7f action err_code \u50b3\u4f86 &quot;A&quot;\uff0c\u6bd4\u5c0d\u7684\u7d50\u679c\u4ecd\u7136\u662f false \u4ee5\u4e0a\u7684\u5beb\u6cd5\u6bd4\u5c0d\u7684\u7d50\u679c\u624d\u6703\u662f true [ratings]"},"aioseo_meta_data":{"post_id":"768","title":null,"description":null,"keywords":[{"label":"Struts2,Exception","value":"Struts2,Exception"}],"keyphrases":null,"primary_term":null,"canonical_url":null,"og_title":null,"og_description":null,"og_object_type":"default","og_image_type":"default","og_image_url":null,"og_image_width":null,"og_image_height":null,"og_image_custom_url":null,"og_image_custom_fields":null,"og_video":null,"og_custom_url":null,"og_article_section":null,"og_article_tags":null,"twitter_use_og":false,"twitter_card":"default","twitter_image_type":"default","twitter_image_url":null,"twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_title":null,"twitter_description":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":[],"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"Article","isEnabled":true},"graphs":[]},"schema_type":null,"schema_type_options":null,"pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":null,"robots_max_videopreview":null,"robots_max_imagepreview":"large","priority":null,"frequency":null,"local_seo":null,"breadcrumb_settings":null,"limit_modified_date":false,"ai":null,"created":"2020-12-24 01:26:19","updated":"2025-06-05 09:27:05","seo_analyzer_scan_date":null},"aioseo_breadcrumb":"<div class=\"aioseo-breadcrumbs\"><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/blog.amjet.biz\/IT\" title=\"Home\">Home<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/blog.amjet.biz\/IT\/?cat=5\" title=\"Developer\">Developer<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/blog.amjet.biz\/IT\/?cat=8\" title=\"Java\">Java<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\tStruts2 tips\n\t\t<\/span><\/div>","aioseo_breadcrumb_json":[{"label":"Home","link":"https:\/\/blog.amjet.biz\/IT"},{"label":"Developer","link":"https:\/\/blog.amjet.biz\/IT\/?cat=5"},{"label":"Java","link":"https:\/\/blog.amjet.biz\/IT\/?cat=8"},{"label":"Struts2 tips","link":"https:\/\/blog.amjet.biz\/IT\/?p=768"}],"_links":{"self":[{"href":"https:\/\/blog.amjet.biz\/IT\/index.php?rest_route=\/wp\/v2\/posts\/768","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=768"}],"version-history":[{"count":4,"href":"https:\/\/blog.amjet.biz\/IT\/index.php?rest_route=\/wp\/v2\/posts\/768\/revisions"}],"predecessor-version":[{"id":785,"href":"https:\/\/blog.amjet.biz\/IT\/index.php?rest_route=\/wp\/v2\/posts\/768\/revisions\/785"}],"wp:attachment":[{"href":"https:\/\/blog.amjet.biz\/IT\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=768"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.amjet.biz\/IT\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=768"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.amjet.biz\/IT\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=768"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}