rem ¿´µ½ºÜ¶à³õѧÕß·´¸´ÎÊÕâ¸öÎÊÌ⣬дÁËÒ»¸öºÜ¼òµ¥µÄÒ»¸ö½Å±¾£¬ÓÃÓÚ×Ô¶¯ÉèÖû·¾³±äÁ¿¡£°Ñ´úÂ뿽±´£¬Áí´æÎªjavaEnv.bat¡£°²×°ÍêJava 2 SDKÖ®ºó£¬¿ªÒ»¸öÃüÁîÐд°¿Ú,ÊäÈëjavaEnv java2SDKDir(java2SDKDirÊÇÄãµÄjavaµÄ°²×°Ä¿Â¼£¬²»´øÂ·¾¶×îºóµÄ\¡£Èç¹û°²×°Â·¾¶ÖÐÓпոñ£¬ÇëÓÃjavaEnv "java2SDKDir"¸ñʽ)²¢ÔËÐС£(×¢£ºÒ»¶¨ÒªÔÚjavaEnvºó±ß¼ÓÉÏÄãµÄsdkµÄĿ¼£¬setxµÄÎÊÌâ¿ÉÒÔ¿´ÕâÀï)
@echo ÄãÌṩµÄjdk°²×°Ä¿Â¼Îª£º%1
@echo off
IF EXIST %1\bin\java.exe (
rem ÈçÊäÈëÕýÈ·µÄ Java2SDK °²×°Ä¿Â¼£¬¿ªÊ¼ÉèÖû·¾³±äÁ¿
@setx JAVA_HOME %1
@setx path %JAVA_HOME%\bin;%path%
@setx classpath %classpath%;.
@setx classpath %classpath%;%JAVA_HOME%\lib\tools.jar
@setx classpath %classpath%;%JAVA_HOME%\lib\dt.jar
@setx classpath %classpath%;%JAVA_HOME%\jre\lib\rt.jar
@echo on
@echo Java 2 SDK »·¾³²ÎÊýÉèÖÃÍê±Ï£¬Õý³£Í˳ö¡£
) ELSE (
IF %1=="" (
rem ÈçûÓÐÌṩ°²×°Ä¿Â¼£¬Ìáʾ֮ºóÍ˳ö
@echo on
@echo ûÓÐÌṩ Java2SDK µÄ°²×°Ä¿Â¼,²»×öÈκÎÉèÖã¬ÏÖÔÚÍ˳ö»·¾³±äÁ¿ÉèÖá£
) ELSE (
rem Èç¹ûÌṩ·Ç¿ÕµÄ°²×°Ä¿Â¼µ«Ã»ÓÐbin\java.exe£¬Ôò ......
HTTP(Hyper-Text Transfer Protocol)Êǵ±Ç°ÒòÌØÍøÉÏʹÓÃ×î¶àµÄÐÒé¡£ÍøÂç·þÎñ£¬ÍøÂçÉ豸ÒÔ¼°ÍøÂç¼ÆËãµÄÔö³¤²»½öÔö¼ÓÁËÐèÒªHTTPÖ§³ÖµÄµÄÓ¦ÓóÌÐò£¬»¹À©Õ¹ÁËHTTPµÄ½ÇÉ«£¬Ê¹Æä²»½ö½öÓ¦ÓÃÓÚÓû§Çý¶¯µÄwebä¯ÀÀÆ÷¡£ java.net°üÌṩͨ¹ýHTTP·ÃÎÊ×ÊÔ´µÄ»ù±¾¹¦ÄÜ¡£HttpClientÉ跨ͨ¹ýʵÏÖÒ»¸ö¸ßЧµÄ£¬×îÐµģ¬¹¦ÄܷḻµÄHttp¿Í»§¶ËÀ´Ìî²¹ÕâÒ»¿Õ°×¡£ÕâÖÖʵÏÖÊÇ»ùÓÚ×îеÄHTTP±ê×¼ºÍ½¨ÒéµÄ¡£ HttpClient¿ÉÒÔ°ïÖúÄ㿪·¢webä¯ÀÀÆ÷£¬web·þÎñ¿Í»§¶ËµÈ¡£Ëü¸²¸ÇÒ»ÏÂÈý¸ö·½Ã棺 »ùÓÚHttpCoreµÄHTTP´«Êä¿Í»§¶Ë¿â »ùÓÚ¾µäµÄ(×èÈûʽ)I/O Content agnostic HttpClient²»ÊÇʲô HttpClient²»ÊÇä¯ÀÀÆ÷¡£ËüµÄÄ¿µÄÊÇ·¢ËͲ¢½ÓÊÜHTTPÏûÏ¢¡£HttpClient²»»áÆóͼ´¢´æÄÚÈÝ£¬Ö´ÐÐHTMLÒ³ÃæÖеÄJavaScript£¬²Â²âÄÚÈݵÄÀàÐÍ»òÕßÖØ¶¨ÇëÇó¸ñʽ/ÖØ¶¨ÏòURIs£¬»òÕ߯äËûÓëHTTP´«ÊäÎ޹صŦÄÜ¡£ Á¬½Ó£ºHttpClient¹Ù·½½Ì³Ì¡£ ......
Ö®ËùÒÔдÕâÆª²©¿Í£¬ÊÇÒòΪǰ¼¸Ìì²ÅÅöµ½ÁËÕâôһ¸öÎÊÌ⣬ÒÔǰ»¹²»ÖªµÀmysqlÓÐÕâôһ¸öÎÊÌâ¡£
ÎÒÃǵÄϵͳʹÓÃÁËstruts+hibernate£¬Êý¾Ý¿âʹÓõÄÊÇmysql£¬×Ö·û¼¯Í³Ò»Îªutf-8¡£
±¾À´ÒѾÍê³ÉÁË£¬µ«ÊÇϵͳʹÓõÄʱºò£¬·¢ÏÖ²é³öÀ´µÄÈËÃûûÓÐ˳Ðò£¬±¾À´ÒÔΪºÜ¼òµ¥£¬ÔÚ²éѯµÄʱºò£¬Ö¸¶¨°´ÕÕnameÅÅÐò¾Í¿ÉÒÔÁË£¬Æñ֪ʵ¼ÊÒ»×ö²Å·¢ÏÖÎÊÌ⣺mysqlÊý¾Ý¿âʹÓÃ×Ö·û¼¯Îªutf-8£¬²éѯ³öÀ´µÄÖÐÎĸù±¾²»Êǰ´ÕÕÆ´ÒôÅÅÐòµÄ¡£
ÎҵĽâ¾ö·½°¸´óÖÂÊÇ£º
¢Ù
ÔÚ
sql
Óï¾äÖÐ×öÊֽţ¬ÔÚ²éѯµÄʱºòÅÅÐò¡£
¢Ú
Èç¹û²»Ðвéѯ³öÀ´£¬ÔÚ³ÌÐòÖУ¬×Ô¼ºÐ´¸ö·½·¨ÅÅÐò¡£
¢Û
×î²îµÄ½â¾ö°ì·¨¾ÍÊÇÐÞ
¸Ä
name
×ֶΣ¬×Ö·û¼¯Ê¹ÓÃgbk£¨»ògb2312£©
ÏÔÈ»£¬µÚÒ»ÖÖ·½·¨ÊÇ×î¸ßЧµÄ£¬µÚÈýÖз½·¨ÊÇ×î²î¾¢µÄ¡£
²»ÄÜÖ±½ÓÔÚ³ÌÐòÖиģ¬ÏÈ×ö¼¸¸öÊÔÑ飺
ÊÔÑéÒ»£ºmysqlÖÐÎÄÅÅÐò
×¼±¸¹¤×÷£º
ÔÚmysqlÖн¨Á¢Ò»¸öÊý¾Ý¿â£¬¾ÍʹÓÃtest°É£¬½¨Á½¸ö±ítest1ºÍtest2£¬¾ùÉèÖÃÁ½¸ö×ֶΣ¬idºÍname£¬ÒªÇóÊÇtest1.nameÕâ¸ö×Ö¶ÎʹÓõÄ×Ö·û¼¯ÎªUTF-8£¬test2.nameÕâ¸ö×Ö¶ÎʹÓõÄ×Ö·û¼¯ÎªGBK£¬ÊäÈ뼸ÌõÊý¾Ý£¬¼ÇµÃÒªÊäÈëÖÐÎİ¡¡£
......
Ö®ËùÒÔдÕâÆª²©¿Í£¬ÊÇÒòΪǰ¼¸Ìì²ÅÅöµ½ÁËÕâôһ¸öÎÊÌ⣬ÒÔǰ»¹²»ÖªµÀmysqlÓÐÕâôһ¸öÎÊÌâ¡£
ÎÒÃǵÄϵͳʹÓÃÁËstruts+hibernate£¬Êý¾Ý¿âʹÓõÄÊÇmysql£¬×Ö·û¼¯Í³Ò»Îªutf-8¡£
±¾À´ÒѾÍê³ÉÁË£¬µ«ÊÇϵͳʹÓõÄʱºò£¬·¢ÏÖ²é³öÀ´µÄÈËÃûûÓÐ˳Ðò£¬±¾À´ÒÔΪºÜ¼òµ¥£¬ÔÚ²éѯµÄʱºò£¬Ö¸¶¨°´ÕÕnameÅÅÐò¾Í¿ÉÒÔÁË£¬Æñ֪ʵ¼ÊÒ»×ö²Å·¢ÏÖÎÊÌ⣺mysqlÊý¾Ý¿âʹÓÃ×Ö·û¼¯Îªutf-8£¬²éѯ³öÀ´µÄÖÐÎĸù±¾²»Êǰ´ÕÕÆ´ÒôÅÅÐòµÄ¡£
ÎҵĽâ¾ö·½°¸´óÖÂÊÇ£º
¢Ù
ÔÚ
sql
Óï¾äÖÐ×öÊֽţ¬ÔÚ²éѯµÄʱºòÅÅÐò¡£
¢Ú
Èç¹û²»Ðвéѯ³öÀ´£¬ÔÚ³ÌÐòÖУ¬×Ô¼ºÐ´¸ö·½·¨ÅÅÐò¡£
¢Û
×î²îµÄ½â¾ö°ì·¨¾ÍÊÇÐÞ
¸Ä
name
×ֶΣ¬×Ö·û¼¯Ê¹ÓÃgbk£¨»ògb2312£©
ÏÔÈ»£¬µÚÒ»ÖÖ·½·¨ÊÇ×î¸ßЧµÄ£¬µÚÈýÖз½·¨ÊÇ×î²î¾¢µÄ¡£
²»ÄÜÖ±½ÓÔÚ³ÌÐòÖиģ¬ÏÈ×ö¼¸¸öÊÔÑ飺
ÊÔÑéÒ»£ºmysqlÖÐÎÄÅÅÐò
×¼±¸¹¤×÷£º
ÔÚmysqlÖн¨Á¢Ò»¸öÊý¾Ý¿â£¬¾ÍʹÓÃtest°É£¬½¨Á½¸ö±ítest1ºÍtest2£¬¾ùÉèÖÃÁ½¸ö×ֶΣ¬idºÍname£¬ÒªÇóÊÇtest1.nameÕâ¸ö×Ö¶ÎʹÓõÄ×Ö·û¼¯ÎªUTF-8£¬test2.nameÕâ¸ö×Ö¶ÎʹÓõÄ×Ö·û¼¯ÎªGBK£¬ÊäÈ뼸ÌõÊý¾Ý£¬¼ÇµÃÒªÊäÈëÖÐÎİ¡¡£
......
Ïß³Ì Thread setDaemon ·½·¨
2009Äê07ÔÂ24ÈÕ ÐÇÆÚÎå 14:37
Thread setDaemon ·½·¨
import java.io.IOException;
/*
* ÊØ»¤Ïß³ÌÔÚûÓÐÓû§Ï߳̿ɷþÎñʱ×Ô¶¯À뿪
* ÔÚJavaÖбȽÏÌØÊâµÄÏß³ÌÊDZ»³ÆÎªÊØ»¤£¨Daemon£©Ï̵߳ĵͼ¶±ðÏ̡߳£
* Õâ¸öÏ߳̾ßÓÐ×îµÍµÄÓÅÏȼ¶£¬ÓÃÓÚΪϵͳÖÐµÄÆäËü¶ÔÏóºÍÏß³ÌÌṩ·þÎñ¡£
* ½«Ò»¸öÓû§Ïß³ÌÉèÖÃÎªÊØ»¤Ï̵߳ķ½Ê½ÊÇÔÚÏ̶߳ÔÏó´´½¨Ö®Ç°µ÷ÓÃÏ̶߳ÔÏóµÄsetDaemon·½·¨¡£
* µäÐ͵ÄÊØ»¤Ïß³ÌÀý×ÓÊÇJVMÖеÄϵͳ×ÊÔ´×Ô¶¯»ØÊÕỊ̈߳¬
* ÎÒÃÇËùÊìϤµÄJavaÀ¬»ø»ØÊÕÏ߳̾ÍÊÇÒ»¸öµäÐ͵ÄÊØ»¤Ị̈߳¬
* µ±ÎÒÃǵijÌÐòÖв»ÔÙÓÐÈκÎÔËÐÐÖеÄThread£¬
* ³ÌÐò¾Í²»»áÔÙ²úÉúÀ¬»ø£¬À¬»ø»ØÊÕÆ÷Ò²¾ÍÎÞÊ¿É×ö£¬
* ËùÒÔµ±À¬»ø»ØÊÕÏß³ÌÊÇJavaÐéÄâ»úÉϽöÊ£µÄÏß³Ìʱ£¬JavaÐéÄâ»ú»á×Ô¶¯À뿪¡£
* ËüʼÖÕÔڵͼ¶±ðµÄ״̬ÖÐÔËÐУ¬ÓÃÓÚʵʱ¼à¿ØºÍ¹ÜÀíϵͳÖеĿɻØÊÕ×ÊÔ´¡£
* ÊØ»¤½ø³Ì£¨Daemon£©ÊÇÔËÐÐÔÚºǫ́µÄÒ»ÖÖÌØÊâ½ø³Ì¡£Ëü¶ÀÁ¢ÓÚ¿ØÖÆÖն˲¢ÇÒÖÜÆÚÐÔµØÖ´ÐÐijÖÖÈÎÎñ»òµÈ´ý´¦ÀíijЩ·¢ÉúµÄʼþ¡£
* Ò²¾ÍÊÇËµÊØ»¤Ï̲߳»ÒÀÀµÓÚÖÕ¶Ë£¬µ«ÊÇÒÀÀµÓÚϵͳ£¬Óëϵͳ“ͬÉú¹²ËÀ”¡£
......
²éÁ˺ܶà×ÊÁÏ£¬×ÜËã¶Ô½Ó¿ÚµÄ¸ÅÄîÂÔ¶®ÁËÒ»µã£¬°´ÎÒ×Ô¼ºµÄÀí½â°Ñ×ÊÁÏÕûÀíÁËһϡ£
JavaÖеĽӿÚÊÇһϵÁз½·¨µÄÉùÃ÷£¬ÊÇһЩ·½·¨ÌØÕ÷µÄ¼¯ºÏ£¬Ò»¸ö½Ó¿ÚÖ»Óз½·¨µÄÌØÕ÷ûÓз½·¨µÄʵÏÖ£¬Òò´ËÕâЩ·½·¨¿ÉÒÔÔÚ²»Í¬µÄµØ·½±»²»Í¬µÄÀàʵÏÖ£¬¶øÕâЩʵÏÖ¿ÉÒÔ¾ßÓв»Í¬µÄÐÐΪ(¹¦ÄÜ)¡£
¿ÉÒÔÕâÑùÀí½â£¬ÀàÃèÊöÁËÒ»¸öʵÌ壬°üÀ¨ÊµÌåµÄ״̬£¬Ò²°üÀ¨ÊµÌå¿ÉÄÜ·¢³öµÄ¶¯×÷¡£½Ó¿Ú¶¨ÒåÁËÒ»¸öʵÌå¿ÉÄÜ·¢³öµÄ¶¯×÷¡£µ«ÊÇÖ»ÊǶ¨ÒåÁËÕâЩ¶¯×÷µÄÔÐÍ£¬Ã»ÓÐʵÏÖ£¬Ò²Ã»ÓÐÈκÎ״̬ÐÅÏ¢¡£
ÔÚJavaÓïÑԹ淶ÖУ¬Ò»¸ö·½·¨µÄÌØÕ÷½ö°üÀ¨·½·¨µÄÃû×Ö£¬²ÎÊýµÄÊýÄ¿ºÍÖÖÀ࣬¶ø²»°üÀ¨·½·¨µÄ·µ»ØÀàÐÍ£¬²ÎÊýµÄÃû×ÖÒÔ¼°ËùÅ׳öÀ´µÄÒì³£¡£
½Ó¿Ú¼Ì³ÐºÍʵÏּ̳еĹæÔò²»Í¬£¬Ò»¸öÀàÖ»ÓÐÒ»¸öÖ±½Ó¸¸À࣬µ«¿ÉÒÔʵÏÖ¶à¸ö½Ó¿Ú¡£
½Ó¿ÚÓеãÏóÒ»¸ö¹æ·¶¡¢Ò»¸öÐÒ飬ÊÇÒ»¸ö³éÏóµÄ¸ÅÄ¶øÀàÔòÊÇʵÏÖÁËÕâ¸öÐÒ飬Âú×ãÁËÕâ¸ö¹æ·¶µÄ¾ßÌåʵÌ壬ÊÇÒ»¸ö¾ßÌåµÄ¸ÅÄî¡£
¡¡¡¡´Ó³ÌÐò½Ç¶È£¬¼òµ¥Àí½â£¬½Ó¿Ú¾ÍÊǺ¯ÊýÉùÃ÷£¬Àà¾ÍÊǺ¯ÊýʵÏÖ¡£ÐèҪעÒâµÄÊÇͬһ¸öÉùÃ÷¿ÉÄÜÓкܶàÖÖʵÏÖ¡£
¡¡¡¡ËùÒÔ¾ÍÄãµÄÎÊÌ⣺
¡¡¡¡1¡¢½Ó¿ÚÖж¨ÒåÀà·½·¨µÄÔÐÍ£¬Êµ¼ÊÉϽӿÚûÓж¨ÒåÈκÎʵÏÖÌå¡£¾ßÌåµÄÊµÏ ......
java»ù´¡¼¼Êõ֪ʶ¸´Ï°
Ò»¡¢ ¼ÆËã»ú»ù´¡ÖªÊ¶£º°üÀ¨Êý¾Ý½á¹¹ÖеĻù±¾Ëã·¨£¬¼ÆËã»úÍøÂçµÄOSI£¬TCP/IPÄ£ÐÍ¡£
¼ÆËã»úÍøÂçµÄOSI£ºOSI(Open System Interconnnection OSI)¿ª·Åʽϵͳ»¥Á¬£¬ ÊÇÓɹú¼Ê»¯±ê×¼×éÖ¯£¨ISO£©Öƶ¨µÄ±ê×¼»¯¿ª·ÅʽµÄ¼ÆËã»úÍøÂç²ã´Î½á¹¹Ä£ÐÍ
°üÀ¨Æß²ã£º
Ó¦Óò㣨Application Layer)—— ²Ù×÷ϵͳ»òÍøÂçÓ¦ÓóÌÐòÌṩ·ÃÎÊÍøÂç·þÎñµÄ½Ó¿Ú¡£ÐÒéµÄ´ú±í°üÀ¨£ºTelnet¡¢FTP¡¢HTTP¡¢SNMP
±íʾ²ã£¨Presentation Layer)——Ö÷Òª½â¾öÓû§ÐÅÏ¢µÄÓï·¨±íʾÎÊÌâ
»á»°²ã£¨Session Layer£©——»á»°µØÖ·Ó³ÉäΪÔËÊ䵨£¬Ñ¡ÔñÐèÒªµÄÔËÊä·þÎñÖÊÁ¿²ÎÊý(QOS)£¬´«ËÍÓÐÏÞµÄ͸Ã÷Óû§Êý¾Ý£¬Êý¾Ý´«Êä½×¶Î
´«Êä²ã£¨Transport Layer)——´«Êä²ãÐÒéµÄ´ú±í°üÀ¨£ºTCP¡¢UDP¡¢SPX
Ô´¶Ëµ½Ä¿µÄ¶Ë¶ÔÊý¾Ý´«ËͽøÐпØÖƴӵ͵½¸ßµÄ×îºóÒ»²ã.£¬²î´í»Ö¸´£¬Á÷Á¿¿ØÖÆ
ÍøÂç²ã(Network Layer)——·ÓÉÑ¡ÔñºÍÖм̼¤»î,ÖÕÖ¹ÍøÂçÁ¬½Ó,¶à²ÉÈ¡·Öʱ¸´Óü¼Êõ£¬²î´í¼ì²âÓë»Ö¸´£¬ÍøÂç¹ÜÀí¡£IpµØÖ·ºÍ¶Ë¿ÚºÅµÄÐźš£É豸£ºÂ·ÓÉÆ÷
Êý¾ÝÁ´Â·²ã£¨Data Link Layer)—— ......