





{"id":1893,"date":"2011-05-25T23:31:32","date_gmt":"2011-05-26T03:31:32","guid":{"rendered":"http:\/\/www.killtest.hk\/?p=1893"},"modified":"2011-05-25T23:31:32","modified_gmt":"2011-05-26T03:31:32","slug":"jsp","status":"publish","type":"post","link":"https:\/\/www.killtest.hk\/index.php\/unix\/jsp\/","title":{"rendered":"JSP\u865b\u64ec\u4e3b\u6a5f\u4f7f\u7528\u4e2d\u7684\u4e82\u78bc\u554f\u984c"},"content":{"rendered":"<p>\u5728\u4f7f\u7528JSP\u7684\u904e\u7a0b\u4e2d\uff0c\u6700\u4f7f\u4eba\u982d\u75bc\u7684\u58f9\u500b\u554f\u984c\u5c31\u662f\u4e2d\u6587\u4e82\u78bc\u554f\u984c\uff0c\u4ee5\u4e0b\u662f\u6211\u5728\u8edf\u4ef6\u958b\u767c\u4e2d\u9047\u5230\u7684\u4e82\u78bc\u554f\u984c\u4ee5\u53ca\u89e3\u6c7a\u65b9\u6cd5\u3002<br \/>\n\u00a0\u00a0\u00a0 POST\u63d0\u4ea4\u8868\u55ae\u662f\u4e82\u78bc<br \/>\n\u00a0\u00a0\u00a0 \u5e38\u898b\u7684\u60c5\u6cc1\u70ba:\u9801\u9762\u90fd\u6b63\u5e38,\u4f46\u65b0\u63d2\u5165\u7684\u6578\u64da\u5168\u662f\u4e82\u78bc.<br \/>\n\u00a0\u00a0\u00a0 \u9019\u7a2e\u60c5\u6cc1,\u5c31\u662f\u56e0\u70ba\u63d0\u4ea4\u7684\u6578\u64da\u88ab\u7a0b\u5e8f\u63a5\u6536\u5f8c\u5c31\u662f\u4e82\u78bc,\u9019\u500b\u4e82\u78bc\u53c8\u63d2\u5165\u6578\u64da\u5eab\u4e86,\u6240\u4ee5\u986f\u793a\u4e0d\u6b63\u5e38<br \/>\n\u00a0\u00a0\u00a0 \u89e3\u6c7a\u65b9\u6848:<br \/>\n\u00a0\u00a0\u00a0 a \u4fee\u6539\u914d\u5236\u4f86\u5b8c\u6210<br \/>\n\u00a0\u00a0\u00a0 \u4fee\u6539tomcat\u7684\u914d\u5236\u6587\u4ef6server.xml\u4e2d\u7684\u9023\u63a5\u5668,\u52a0\u4e0aURIEncoding=&#8221;GB2312&#8243;\u5c31OK\u4e86<br \/>\n\u00a0\u00a0\u00a0 b \u81ea\u5df1\u5beb\u7de8\u78bc\u8f49\u63db\u7a0b\u5e8f<br \/>\n\u00a0\u00a0\u00a0 b.a \u5728\u8207\u8868\u55ae\u4ea4\u63db\u6578\u64da\u7684\u6642\u5019,\u505a\u8f49\u63db,\u9019\u7a2e\u65b9\u5f0f\u9748\u6d3b<br \/>\n\u00a0\u00a0\u00a0 \u6bcf\u58f9\u500b\u9801\u9762\u8acb\u6c42\u5beb\u58f9\u500b\u8f49\u63db,\u6216\u8005\u5beb\u58f9\u500b\u516c\u5171\u7684\u985e,\u5728\u63a5\u6536\u7684\u6642\u5019,\u90fd\u505a\u58f9\u4e0b\u8f49\u79fb,\u4ee3\u78bc\u5982\u4e0b:<br \/>\n\u00a0\u00a0\u00a0 public static String ISOGBChange(String s)<br \/>\n\u00a0\u00a0\u00a0 {<br \/>\n\u00a0\u00a0\u00a0 return EncodeChange(s,&#8221;ISO8859-1&#8243;,&#8221;GB2312&#8243;);<br \/>\n\u00a0\u00a0\u00a0 }<br \/>\n\u00a0\u00a0\u00a0 public static String EncodeChange(String s,String source_encode,String dest_encode)<br \/>\n\u00a0\u00a0\u00a0 {<br \/>\n\u00a0\u00a0\u00a0 if(s==null)<br \/>\n\u00a0\u00a0\u00a0 return null;<br \/>\n\u00a0\u00a0\u00a0 try<br \/>\n\u00a0\u00a0\u00a0 {<br \/>\n\u00a0\u00a0\u00a0 byte[] tmpbyte = s.getBytes(source_encode);\u00a0 s = new String(tmpbyte,dest_encode);<br \/>\n\u00a0\u00a0\u00a0 return s;<br \/>\n\u00a0\u00a0\u00a0 }<br \/>\n\u00a0\u00a0\u00a0 catch (Exception e)<br \/>\n\u00a0\u00a0\u00a0 {<br \/>\n\u00a0\u00a0\u00a0 return &#8220;ERROR&#8221;;<br \/>\n\u00a0\u00a0\u00a0 }<br \/>\n\u00a0\u00a0\u00a0 }<br \/>\n\u00a0\u00a0\u00a0 b.b \u4f7f\u7528tomcat\u7684web.xml\u4e2d\u5b9a\u7fa9\u7684\u904e\u6ffe\u5668filter\u4f86\u8f49\u63db\u6240\u6709\u7684\u8acb\u6c42\u7de8\u78bc<br \/>\n\u00a0\u00a0\u00a0 \u9019\u500b\u9700\u8981\u81ea\u5df1\u53bb\u7814\u7a76\u58f9\u4e0b\u904e\u6ffe\u5668\u7684\u5beb\u6cd5,\u518d\u5177\u9ad4\u7684\u8f49\u63db\u7de8\u78bc,\u9084\u662fb.a\u4e2d\u7684\u4ee3\u78bc\u9032\u884c\u7de8\u78bc\u8f49\u63db\u7684,\u53ea\u662f\u8f49\u79fb\u4e0d\u7528\u518d\u5beb\u5728\u6bcf\u500b\u7a0b\u5e8f\u4e2d\u4e86.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5728\u4f7f\u7528JSP\u7684\u904e\u7a0b\u4e2d\uff0c\u6700\u4f7f\u4eba\u982d\u75bc\u7684\u58f9\u500b\u554f\u984c\u5c31\u662f\u4e2d\u6587\u4e82\u78bc\u554f\u984c\uff0c\u4ee5\u4e0b\u662f\u6211\u5728\u8edf\u4ef6\u958b\u767c\u4e2d\u9047\u5230\u7684\u4e82\u78bc\u554f\u984c\u4ee5\u53ca\u89e3\u6c7a\u65b9\u6cd5\u3002  [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[531],"tags":[791,793,792],"class_list":["post-1893","post","type-post","status-publish","format-standard","hentry","category-unix","tag-jsp","tag-793","tag-792"],"_links":{"self":[{"href":"https:\/\/www.killtest.hk\/index.php\/wp-json\/wp\/v2\/posts\/1893","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.killtest.hk\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.killtest.hk\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.killtest.hk\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.killtest.hk\/index.php\/wp-json\/wp\/v2\/comments?post=1893"}],"version-history":[{"count":0,"href":"https:\/\/www.killtest.hk\/index.php\/wp-json\/wp\/v2\/posts\/1893\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.killtest.hk\/index.php\/wp-json\/wp\/v2\/media?parent=1893"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.killtest.hk\/index.php\/wp-json\/wp\/v2\/categories?post=1893"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.killtest.hk\/index.php\/wp-json\/wp\/v2\/tags?post=1893"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}