Ò׽ؽØÍ¼Èí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

JavaÖÐÈçºÎÕýȷʹÓÃ×ÖÌå±àÂë

 
          ±ðÉùÃ÷£ºÕâÊÇһƪÀ´×ÔwudaleµÄ²©¿ÍµÄÎÄÕÂhttp://wudale.bokee.com/3594651.html
 JavaÊÇĿǰ×îÁ÷ÐеÄÃæÏò¶ÔÏóµÄ±ä³ÉÓïÑÔÖ®Ò»£¬JavaÖ§UTF£­8£¬ISO£­8859£­1¡¢GBKµÈ¸÷ÖÖ×ÖÌå±àÂ룬¿É±ÊÕß·¢ÏÖJavaÖÐ×ÖÌå±àÂëµÄÎÊÌâÈÔÀ§µ¹Á˲»ÉÙ³ÌÐòÔ±£¬ÍøÉÏËäȻҲÓв»ÉÙ¹ØÓÚÔÙJavaÖÐÈçºÎÕýÈ·ÏÔʾÖÐÎĵÄÎÄÕ£¬µ«¶¼²»¹»È«Ã棬±ÊÕßÌØÒâ×ܽáÈçÏ¡·
       Ó°ÏìJavaÖÐ×ÖÌå±àÂëÕýÈ·ÏÔʾµÄÓм¸¸öÒòËØ£º1£©Êý¾Ý¿âµÄÁ´½Ó·½Ê½£»2)ÍøÒ³ÖÐʹÓõÄ×ÖÌå±àÂ룻3£©Êý¾Ý¿âÀï´æ·ÅÊý¾ÝµÄ×ÖÌå±àÂ룻4£©JavaµÄȱʡ×ÖÌå±àÂë¡£Èë¹ÉŶÔÚ±ä³ÉÖÐÓöµ½²»ÄÜÕýÈ·ÏÔʾÖÐÎÄÊÇ£¬ÒªÏÈŪÇå³þÒÔÉϼ¸ÏîËùʹÓõÄ×ÖÌå±àÂ룬ÔÙ·ÖÎöÕÒ³öÔ­Òò£¬¼´¿É½â¾öÎÊÌâ¡£
       ÖÚËùÖÜÖª£¬JSPÊÇJavaµÄÒ»ÖÖ£¬ºÍÍøÒ³Óйأ¬¶øÍøÒ³Ò²ÓÐ×Ô¼ºµÄÖÐÎıàÂëϵͳ£¬ËùÒÔJSP´¦ÀíÖÐÎÄÒª±È´¿JavaµÄÀàÎļþ¸üΪÂé·³¡£±¾ÎĵIJâÊÔÊý¾Ý¿âº¦ËÀMySQL3.2£¬Êý¾Ý¿âÁ´½ÓÇý¶¯ÊÇÓÃorg.gjt.mm.mysql.Driver,ÕâÀïÖ÷ÒªÌÖÂÛUTF£­8ºÍGBkµÄÏÔʾ£¨GB2312ÊÇGBKµÄÒ»¸ö×Ó¼¯£¬JavaÖÚ¿ÉÒÔʹÓÃGBKÀ´´úÌæGBϵÁУ©¡£ÎÒÃÇÏÈÀ´Ñо¿JSPÖÐ×ÖÌå±àÂëÎÊÌ⣬ÏÂÃæµÚÒ»µ½µÚÁùµãÊÇÕë¶ÔJSPµÄ£¨ÒòΪ´ÓÊý¾Ý¿âÀï¶Á³öÖÐÎÄÊý¾ÝÓëдÈëÖÐÎÄÊý¾ÝÓÐËùÇø±ð£¬ÔÛÃÇ·Ö±ð˵Ã÷£¬Ç°ÈýµãÊÇ´Ó¶ÁÈ¡Êý¾Ý¿âµ½ÏÔÊ¾Ò³Ãæ£¬ºóÈýµãÊÇ´ÓÍøÒ³ÊäÈëÊý¾Ýµ½´æÈëÊý¾Ý¿â£©£¬µÚÆßµ½µÚ¾ÅµãÕë¶Ô´¿JavaµÄÀàÎļþ¡£Ò»ÏÂrs±êʶResultSetµÄÒ»¸öÊÓÁ¦£¬ÊÇÖ´ÐÐSelectÓï¾äÖ®ºó²úÉúµÄÊý¾Ý¼¯¡£
Ò»¡¢Êý¾Ý¿âÁ´½Ó·½Ê½Ê¹ÓÃUTF£­8
       ÔÚÁ¬½ÓÊý¾Ý¿âµÄÇý¶¯ºóÃæ¼ÓÉÏÕâ¾ä²ÎÊýuseUnicode=true&characterEncoding=UTF-8,ÀýÈçjdbc:mysql://localhost/DBVF?autoReconnect=true&useUnicode=true&characterEncoding=UTF-8£¬´ÓÊý¾Ý¿âÀï¶Á³öÖÐÎÄÏÔʾÔÚʹÓÃGBkµÄJSPµÄÍøÒ³ÀÈç¹ûÊý¾Ý¿â´æ·ÅµÄ×ÖÌå±àÂëÊÇUTF£­8£¬ÔÚJSPÖÐʹÓÃstr=new String(rs.getBytes(1),”UTF-8”)»òÕßstr=rs.getString(1),¿ÉÒÔÕýÈ·ÏÔʾÖÐÎÄ£¬Èç¹ûÊý¾Ý¿âÀï´æ·ÅµÄÊÇGBkÊý¾Ý£¬ÄÇôJSPÖÐҲҪʹÓÃstr-new String(rs.getBytes(1),”GBK”) À´ÏÔʾÕýÈ·µÄÖÐÎÄ¡£ÖµµÃ×¢ÒâµÄÊÇÈç¹ûÒ³ÃæÊ¹ÓÃUTF£­8£¬Êý¾Ý¿â´æ·ÅµÄÊÇUTF£­8£¬Ò²¿ÉÒÔÓÃstr=new String(rs.getBytes(1),”GBK”)ÕýÈ·ÏÔʾÖÐÎÄ¡£Èç¹ûÒ³ÃæÊÇUTF£­8£¬¶øÊý¾Ý¿âÀï´æ·ÅµÄÊÇGBK£¬ÎÞ·¨Ö±½ÓÏÔʾÖÐÎÄ£¬ÐèÒª2²½×ª»»£¬str=n


Ïà¹ØÎĵµ£º

Java NIO APIÏê½â

 
Java NIO APIÏê½â
ÔÚJDK
1.4ÒÔǰ£¬JavaµÄIO²Ù×÷¼¯ÖÐÔÚjava.ioÕâ¸ö°üÖУ¬ÊÇ»ùÓÚÁ÷µÄ×èÈû£¨blocking£©API¡£¶ÔÓÚ´ó¶àÊýÓ¦ÓÃÀ´Ëµ£¬ÕâÑùµÄAPIʹÓúܷ½
±ã£¬È»¶ø£¬Ò»Ð©¶ÔÐÔÄÜÒªÇó½Ï¸ßµÄÓ¦Óã¬ÓÈÆäÊÇ·þÎñ¶ËÓ¦Óã¬ÍùÍùÐèÒªÒ»¸ö¸üΪÓÐЧµÄ·½Ê½À´´¦ÀíIO¡£´ÓJDK 1.4Æð£¬NIO
API×÷Ϊһ¸ö»ùÓÚ»º³åÇø£¬²¢ÄÜÌṩ·Ç×èÈû(non-blo ......

JavaÃæÊÔÌâ

Ò»¡¢ÃæÏò¶ÔÏóµÄÌØÕ÷ÓÐÄÄЩ·½Ãæ
    1.³éÏó£º
    ³éÏó¾ÍÊǺöÂÔÒ»¸öÖ÷ÌâÖÐÓ뵱ǰĿ±êÎ޹صÄÄÇЩ·½Ã棬ÒÔ±ã¸ü³ä·ÖµØ×¢ÒâÓ뵱ǰĿ±êÓйصķ½Ãæ¡£³éÏó²¢²»´òËãÁ˽âÈ«²¿ÎÊÌ⣬¶øÖ»ÊÇÑ¡ÔñÆäÖеÄÒ»²¿·Ö£¬ÔÝʱ²»Óò¿·Öϸ½Ú¡£³éÏó°üÀ¨Á½¸ö·½Ã棬һÊǹý³Ì³éÏ󣬶þÊÇÊý¾Ý³éÏó¡£
    ......

Effective Java: Item 1

Static Factory Methods
Four Advantages:
1) have names
2) not required to create a new object each time they are invoked
3) return an object of any subtype of their return type
4) reduce the verbosity of creating parameterized type instances.(for example: newInstance() method) ......

Java Web»ù´¡£º¿Í»§¶ËÑéÖ¤

±¾ÎÄ×ªÔØ×ÔÀîÐ÷³ÉÀÏʦµÄ±Ê¼Ç£¬¸ÐлÀîÀÏʦ£¡
WebÓ¦ÓÃÖбØÐëÔÚ¿Í»§¶Ë¶ÔÊäÈëÐÅÏ¢½øÐÐÑéÖ¤£¬Èç¹û·¢ÏÖ´íÎó¿ÉÒÔ¼°Ê±¶ÔÓû§½øÐз´À¡£¬Ò²²»Óõȵ½·þÎñÆ÷·¢ÏÖÖ®ºóÔÙ·´À¡£¬Ò»·½ÃæÊǼõÉÙÁËÓû§µÄµÈ´ýʱ¼ä£¬ÁíÒ»·½Ãæ¼õÉÙ²»±ØÒªµÄ½»»¥¹ý³Ì¡£±¾½ÚÄÚÈݽéÉÜÈçºÎʹÓÃJavaScriptÍê³É¿Í»§¶ËµÄÑéÖ¤¡£
JavaScriptÓïÑÔ
ÔÚWebÓ¦ÓÃÖÐÐèÒªÔÚ¿Í»§¶Ë ......

ÓÃjavaʵÏÖµÄÒ»¸ö¼òµ¥web·þÎñÆ÷³ÌÐò

Ò»¡¢Ê×ÏÈÀ´¿´Ò»ÏÂhttpµÄ±¨ÎĽṹ
1¡¢ÇëÇó±¨ÎÄ
Ò»¸öHTTPÇëÇó±¨ÎÄÓÉÇëÇóÐУ¨request line£©¡¢ÇëÇóÍ·²¿£¨header£©¡¢¿ÕÐкÍÇëÇóÊý¾Ý4¸ö²¿·Ö×é³É£¬ÏÂͼ¸ø³öÁËÇëÇó±¨ÎĵÄÒ»°ã¸ñʽ¡£
(1)ÇëÇóÐÐ
ÇëÇóÐÐÓÉÇëÇó·½·¨×ֶΡ¢URL×ֶκÍHTTPЭÒé°æ±¾×Ö¶Î3¸ö×Ö¶Î×é³É£¬ËüÃÇÓÿոñ·Ö¸ô¡£ÀýÈ磬GET /index.html HTTP/1.1¡£
HTTPЭÒéµÄÇëÇ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ