{"id":436,"date":"2015-09-09T11:43:01","date_gmt":"2015-09-09T03:43:01","guid":{"rendered":"http:\/\/www.fh1986.com\/?p=436"},"modified":"2015-09-09T11:43:01","modified_gmt":"2015-09-09T03:43:01","slug":"%e8%a7%a3%e5%86%b3jsp%e4%b9%b1%e7%a0%81%e9%97%ae%e9%a2%98%e7%9a%84%e6%96%b9%e5%bc%8f%e5%92%8c%e6%80%9d%e8%80%83%e9%80%94%e5%be%84","status":"publish","type":"post","link":"https:\/\/www.fh1986.com\/index.php\/archives\/436.html","title":{"rendered":"\u89e3\u51b3JSP\u4e71\u7801\u95ee\u9898\u7684\u65b9\u5f0f\u548c\u601d\u8003\u9014\u5f84"},"content":{"rendered":"<p>JSP\u4e2d\u7684\u4e71\u7801\u95ee\u9898\u662f\u4e00\u4e2a\u666e\u904d\u7684\u95ee\u9898\uff0c\u5bf9\u4e8e\u521d\u5b66\u8005\u6765\u8bf4\uff0c\u6ca1\u6709\u7ecf\u5386\u8fc7\u4e71\u7801\uff0c\u4e0d\u7b97\u662f\u771f\u6b63\u7684\u521d\u5b66\u8005\u3002\u4f46\u662f\uff0c\u4e71\u7801\u7684\u89e3\u51b3\u65b9\u6cd5\u5374\u662f\u6709\u4e00\u5b9a\u7684\u7b56\u7565\u7684\u3002\u4e00\u822c\u6765\u8bb2\uff0c\u9700\u8981\u505a\u5230\u4ee5\u4e0b\u51e0\u70b9\u3002<\/p>\n<p>1. \u4fee\u6539MYSQL\u670d\u52a1\u5668\u7684\u7f16\u7801<br \/>\u4fee\u6539MYSQL\u7684my.ini\u914d\u7f6e\u6587\u4ef6<\/p>\n<pre class=\"csharpcode\">default-character-set=utf8<\/pre>\n<style type=\"text\/css\">.csharpcode, .csharpcode pre\n{\n\tfont-size: small;\n\tcolor: black;\n\tfont-family: consolas, \"Courier New\", courier, monospace;\n\tbackground-color: #ffffff;\n\t\/*white-space: pre;*\/\n}\n.csharpcode pre { margin: 0em; }\n.csharpcode .rem { color: #008000; }\n.csharpcode .kwrd { color: #0000ff; }\n.csharpcode .str { color: #006080; }\n.csharpcode .op { color: #0000c0; }\n.csharpcode .preproc { color: #cc6633; }\n.csharpcode .asp { background-color: #ffff00; }\n.csharpcode .html { color: #800000; }\n.csharpcode .attr { color: #ff0000; }\n.csharpcode .alt \n{\n\tbackground-color: #f4f4f4;\n\twidth: 100%;\n\tmargin: 0em;\n}\n.csharpcode .lnum { color: #606060; }\n<\/style>\n<p>2.\u4fee\u6539MYSQL\u6570\u636e\u5e93\u7684\u7f16\u7801<br \/>\u4fee\u6539\u5df2\u6709\u7684\u6570\u636e\u5e93\u7f16\u7801<\/p>\n<p><pre class=\"csharpcode\"><span class=\"kwrd\">ALTER<\/span> <span class=\"kwrd\">DATABASE<\/span> databaseName <span class=\"kwrd\">CHARACTER<\/span> <span class=\"kwrd\">SET<\/span> utf8;<\/pre>\n<\/p>\n<p>\u7531\u4e8e\u4fee\u6539\u6570\u636e\u5e93\u7f16\u7801\u4e0d\u4f1a\u5f71\u54cd\u5230\u5df2\u7ecf\u5b58\u5728\u7684\u8868\u7684\u7f16\u7801\uff0c\u56e0\u6b64\uff0c\u8fd8\u9700\u8981\u4fee\u6539\u5df2\u7ecf\u5b58\u5728\u7684\u8868\u3002<\/p>\n<p><pre class=\"csharpcode\"><span class=\"kwrd\">ALTER<\/span> <span class=\"kwrd\">TABLE<\/span> table_name <span class=\"kwrd\">CHARACTER<\/span> <span class=\"kwrd\">SET<\/span> utf8;<\/pre>\n<\/p>\n<p>3.\u4fee\u6539Tomcat\u670d\u52a1\u5668\u7684\u9ed8\u8ba4\u7f16\u7801<br \/>Tomcat\u7684server.xml\u4e2d\u6709\u7f16\u7801\u8bbe\u7f6e\uff0c\u8bbe\u7f6e\u5982\u4e0b<\/p>\n<pre class=\"csharpcode\"><span class=\"kwrd\">&lt;<\/span><span class=\"html\">Connector<\/span> <span class=\"attr\">prot<\/span>=\u201c<span class=\"attr\">8080<\/span>\u201d <span class=\"attr\">protocol<\/span>=\u201c<span class=\"attr\">HTTP<\/span>\/<span class=\"attr\">1<\/span>.<span class=\"attr\">1<\/span>\u201d <span class=\"attr\">connectionTimeOut<\/span>=\u201c<span class=\"attr\">2000<\/span>\u201d <span class=\"attr\">redirectPort<\/span>=\u201c<span class=\"attr\">8443<\/span>\u201d <span class=\"attr\">URIEncodeing<\/span>=\u201c<span class=\"attr\">UTF-8<\/span>\u201d<span class=\"kwrd\">\/&gt;<\/span><\/pre>\n<style type=\"text\/css\">.csharpcode, .csharpcode pre\n{\n\tfont-size: small;\n\tcolor: black;\n\tfont-family: consolas, \"Courier New\", courier, monospace;\n\tbackground-color: #ffffff;\n\t\/*white-space: pre;*\/\n}\n.csharpcode pre { margin: 0em; }\n.csharpcode .rem { color: #008000; }\n.csharpcode .kwrd { color: #0000ff; }\n.csharpcode .str { color: #006080; }\n.csharpcode .op { color: #0000c0; }\n.csharpcode .preproc { color: #cc6633; }\n.csharpcode .asp { background-color: #ffff00; }\n.csharpcode .html { color: #800000; }\n.csharpcode .attr { color: #ff0000; }\n.csharpcode .alt \n{\n\tbackground-color: #f4f4f4;\n\twidth: 100%;\n\tmargin: 0em;\n}\n.csharpcode .lnum { color: #606060; }\n<\/style>\n<p>4.\u4fee\u6539JSP\u7684\u9875\u9762\u7f16\u7801<br \/>JSP\u9875\u9762\u7684\u7f16\u7801\u901a\u5e38\u5305\u62ec\u6587\u4ef6\u672c\u8eab\u7684\u7f16\u7801\u548c\u9875\u9762\u9876\u90e8\u7684\u58f0\u660e\u7684\u7f16\u7801<\/p>\n<pre class=\"csharpcode\"><span class=\"asp\">&lt;%@ page language=\"java\" import=\"java.util.*\u201d pageEncoding=\"utf-8\"%&gt;<\/span><\/pre>\n<style type=\"text\/css\">.csharpcode, .csharpcode pre\n{\n\tfont-size: small;\n\tcolor: black;\n\tfont-family: consolas, \"Courier New\", courier, monospace;\n\tbackground-color: #ffffff;\n\t\/*white-space: pre;*\/\n}\n.csharpcode pre { margin: 0em; }\n.csharpcode .rem { color: #008000; }\n.csharpcode .kwrd { color: #0000ff; }\n.csharpcode .str { color: #006080; }\n.csharpcode .op { color: #0000c0; }\n.csharpcode .preproc { color: #cc6633; }\n.csharpcode .asp { background-color: #ffff00; }\n.csharpcode .html { color: #800000; }\n.csharpcode .attr { color: #ff0000; }\n.csharpcode .alt \n{\n\tbackground-color: #f4f4f4;\n\twidth: 100%;\n\tmargin: 0em;\n}\n.csharpcode .lnum { color: #606060; }\n<\/style>\n<p>5.\u4fee\u6539\u6570\u636e\u5e93\u8fde\u63a5\u5b57\u7b26\u4e32\u7684\u7f16\u7801<br \/>\u5728\u521b\u5efaconnection\u65f6\u6307\u5b9a\u7f16\u7801\u7684\u65b9\u5f0f\uff0c\u4ee3\u7801\u5982\u4e0b<\/p>\n<pre class=\"csharpcode\">Connection conn=DriverManager.getConnection(\u201cjdbc:mysql:<span class=\"rem\">\/\/localhost:3306\/databaseWeb?unicode=true&amp;characterEncodeing=UTF-8\u201d,\u201droot\u201d,\u201dadmin\u201d);<\/span>\n<\/pre>\n<style type=\"text\/css\">.csharpcode, .csharpcode pre\n{\n\tfont-size: small;\n\tcolor: black;\n\tfont-family: consolas, \"Courier New\", courier, monospace;\n\tbackground-color: #ffffff;\n\t\/*white-space: pre;*\/\n}\n.csharpcode pre { margin: 0em; }\n.csharpcode .rem { color: #008000; }\n.csharpcode .kwrd { color: #0000ff; }\n.csharpcode .str { color: #006080; }\n.csharpcode .op { color: #0000c0; }\n.csharpcode .preproc { color: #cc6633; }\n.csharpcode .asp { background-color: #ffff00; }\n.csharpcode .html { color: #800000; }\n.csharpcode .attr { color: #ff0000; }\n.csharpcode .alt \n{\n\tbackground-color: #f4f4f4;\n\twidth: 100%;\n\tmargin: 0em;\n}\n.csharpcode .lnum { color: #606060; }\n<\/style>\n","protected":false},"excerpt":{"rendered":"<p>JSP\u4e2d\u7684\u4e71\u7801\u95ee\u9898\u662f\u4e00\u4e2a\u666e\u904d\u7684\u95ee\u9898\uff0c\u5bf9\u4e8e\u521d\u5b66\u8005\u6765\u8bf4\uff0c\u6ca1\u6709\u7ecf\u5386\u8fc7\u4e71\u7801\uff0c\u4e0d\u7b97\u662f\u771f\u6b63\u7684\u521d\u5b66\u8005\u3002\u4f46\u662f\uff0c\u4e71\u7801\u7684\u89e3\u51b3\u65b9\u6cd5\u5374 &hellip; <a href=\"https:\/\/www.fh1986.com\/index.php\/archives\/436.html\" class=\"more-link\">\u7ee7\u7eed\u9605\u8bfb<span class=\"screen-reader-text\">\u89e3\u51b3JSP\u4e71\u7801\u95ee\u9898\u7684\u65b9\u5f0f\u548c\u601d\u8003\u9014\u5f84<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[9,1,3],"tags":[],"_links":{"self":[{"href":"https:\/\/www.fh1986.com\/index.php\/wp-json\/wp\/v2\/posts\/436"}],"collection":[{"href":"https:\/\/www.fh1986.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.fh1986.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.fh1986.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.fh1986.com\/index.php\/wp-json\/wp\/v2\/comments?post=436"}],"version-history":[{"count":0,"href":"https:\/\/www.fh1986.com\/index.php\/wp-json\/wp\/v2\/posts\/436\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.fh1986.com\/index.php\/wp-json\/wp\/v2\/media?parent=436"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.fh1986.com\/index.php\/wp-json\/wp\/v2\/categories?post=436"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.fh1986.com\/index.php\/wp-json\/wp\/v2\/tags?post=436"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}