JavaÓëmysqlÂÒÂëµÄÎÊÌâ
°²×°Ñ¡ÔñGBK£¬Ê¹ÓÃÑ¡ÔñUTF-8¡£
½â¾ö·½·¨Ò»:(×îÖØÒªµÄÒ»ÖÖ·½·¨)
´ò¿ªmysqlĿ¼ÏµÄbinÎļþ¼Ð£¬ÕÒµ½my.ini£¬Ê¹ÓüÇʱ¾ÕÒ¿ª£¬·Ö±ðÕÒ“[mysql]¡¢[client]¡¢[mysqld]”£¬Ìí¼Ó£¨»ò¸Ä³É£©“default-character-set=utf8”¡£
[mysql]
default-character-set=utf8
[client]
default-character-set=utf8
[mysqld]
default-character-set=utf8
È»ºó½¨Á¢±íʱ£¬Ò²ÒªÓ㨱ÈÈ磩
DROP TABLE IF EXISTS `Company`;
CREATE TABLE IF NOT EXISTS `Company`
(
`Cname` VARCHAR(10) NOT NULL,
`Caddr` VARCHAR(100),
`Ctel` VARCHAR(16)
)ENGINE=InnoDB DEFAULT CHARSET=UTF8;
ÕâÑù¾ÍûÎÊÌâ¡£
Èç¹ûÊÇjspÒªÉùÃ÷£º
contentType="text/html;charset=gb2312"
&
Ïà¹ØÎĵµ£º
½ñÌìÏë¶ÁÈ¡srcϵÄÅäÖÃÎļþ£¬ÒÔǰһֱûÕÒµ½·½·¨£¬½ñÌìÑо¿ÁËÏÂÖÕÓÚOKÁË
System.out.println("path1:" + getClass().getResource("config.xml").getPath());
System.out.println("path2:" + getClass().getClassLoader().getResource("config.xml").getPath());
path1:/D:/DJ/workspace/.metadata ......
java.version Java Runtime Environment version
java.vendor Java Runtime Environment vendor
java.vendor.url   ......
¶ÔÓÚjavaÏîÄ¿ÖеİüÃüÃû¶ÔÓÚ¿ª·¢ÈËÔ±À´ËµÔÙ¼òµ¥²»¹ýÁË£¬¿ÉÄÜÓÐЩÈËÈÏΪÈç¹û²ÉÓÃStruts+Spring+Hibernate¿ª·¢¿ò¼Ü£¬ÄÇô¾ÍÓÃaction+service+modelÀ´ÃüÃûºÃÁË£¬²ã´ÎÇåÎú£¬Ò×ÓÚÀí½â£¬ÕâЩ¿´ËÆÃ»ÓÐÈκÎÎÊÌ⣬µ«ÊÇÄãÓÐûÓÐÅöµ½¹ýҪʵÏÖ¸ö¹¦ÄÜʱ£¬ÏîÄ¿ÀïµÄÀàÎļþºÜ¶à£¬ÄãÐèÒªÔÚaction¡¢service¡¢model°üÏÂÀ´» ......
½ñÌìµÄ±ÊÊÔ×îºóÒ»Ì⿼µÄ»¹ÊÇ×Ö·û´®Ìæ»»ÕâÖÖÌ⣬»¨Á˺þÃ×ÜËãдÍêÁË£¡µ«»ØÀ´ÒÔºóËÑÁËһϣ¬Ò»ÏÂ×Ó»¢µ½ÁË£¬È˼ÒÖ»ÒªÒ»¾ä´úÂë¾Í°ÑÎÊÌâ½â¾öÁË£¬²»µÃ²»Åå·þNB°¡£¡
public static void replaceString(String a,String b,String c){
Sy ......