java»ñÈ¡Ò³Ãæ±àÂë
http://babyjoycry.javaeye.com/blog/587527
1. import info.monitorenter.cpdetector.io.CodepageDetectorProxy;
2. import info.monitorenter.cpdetector.io.HTMLCodepageDetector;
3. import info.monitorenter.cpdetector.io.JChardetFacade;
4.
5. import java.io.BufferedReader;
6. import java.io.IOException;
7. import java.io.InputStreamReader;
8. import java.net.HttpURLConnection;
9. import java.net.URL;
10. import java.util.Iterator;
11. import java.util.List;
12. import java.util.Map;
13. import java.util.Set;
14.
15. public class WebEncoding {
16. private static CodepageDetectorProxy detector = CodepageDetectorProxy
17. .getInstance();
18. static {
19.
20. detector.add(new HTMLCodepageDetector(false));
21.
22. detector.add(JChardetFacade.getInstance());
23.
24. }
25. /** ²âÊÔÓÃÀý
26. * @param args
27. */
28. public static void main(String[] args) {
29. WebEncoding web=new WebEncoding();
30. try {
31. System.out.println(web.getCharset("http://www.pujia.com/"));
32. } catch (IOException e) {
33. // TODO Auto-generated catch block
34. e.printStackTrace();
35. }
36. }
37. /**
38. * @param strurl
39. * Ò³ÃæurlµØÖ·,ÐèÒªÒÔ http://¿ªÊ¼£¬Àý£ºhttp: //www.pujia.com
40. * @return
41. * @throws IOException
42. */
43. public String getCharset(String strurl) throws IOException {
44. // ¶¨ÒåURL¶ÔÏó
45. URL url = new URL(strurl);
46. // »ñÈ¡httpÁ¬½Ó¶ÔÏó
47. HttpURLConnection urlConnection = (HttpURLConnection) url
48. .openConnection();
49. ;
50. urlConnection.connect();
51. // ÍøÒ³±àÂ
Ïà¹ØÎĵµ£º
ÔÚjavaÖÐÓÐ3¸öÀàÀ´¸ºÔð×Ö·ûµÄ²Ù×÷¡£
1.Character ÊǽøÐе¥¸ö×Ö·û²Ù×÷µÄ£¬
2.String ¶ÔÒ»´®×Ö·û½øÐвÙ×÷¡£²»¿É±äÀà¡£
3.StringBuffer Ò²ÊǶÔÒ»´®×Ö·û½øÐвÙ×÷£¬µ«ÊǿɱäÀà¡£
String:
ÊǶÔÏó²»ÊÇÔʼÀàÐÍ.
Ϊ²»¿É±ä¶ÔÏó,Ò»µ©±»´´½¨,¾Í²»ÄÜÐÞ¸ÄËüµÄÖµ.
¶ÔÓÚÒѾ´æÔÚµÄString¶ÔÏóµÄÐÞ¸ ......
Ä¿±ê:Óа²×°³ÌÐò°üÏñ°²×°qqÒ»Ñù¼òµ¥Ò»Ö±ÏÂÒ»²½¼´¿É ,¿ÉÐ¶ÔØ,ÒªÇó³ÌÐò×Ô¶¯Æô¶¯,²»ÐèÒªµ¥¶À°²×°JRE,¾ÍÔÚдÕâÌ×½â¾ö·½°¸µÄʱºò,ÎÒÕæÊǰٰãÍ´ºÞ΢Èí.°¥ÎÞÄΰ¡.ÐÒºÃ×îÖÕ»¹ÊDZ»ÎÒÏë³öÀ´ÁË,·ÖÏíϰɡ£
µÚÒ»²½
jre¼õ·Ê,ɾ³ýjre\lib\rt.jarÖв»Ê¹ÓõÄÀà,ɾ³ýcharsets.jarÖв»Ê¹ÓõÄ×Ö·û¼¯±àÂë.MyWork¿ªÔ´ÏîÄ¿(http://mywor ......
¿É¹©³ÌÐòÀûÓõÄ×ÊÔ´£¨ÄÚ´æ¡¢CPUʱ¼ä¡¢ÍøÂç´ø¿íµÈ£©ÊÇÓÐÏ޵ģ¬ÓÅ»¯µÄÄ¿µÄ¾ÍÊÇÈóÌÐòÓþ¡¿ÉÄÜÉÙµÄ×ÊÔ´Íê³ÉÔ¤¶¨µÄÈÎÎñ¡£ÓÅ»¯Í¨³£°üº¬Á½·½ÃæµÄÄÚÈÝ£º¼õС´úÂëµÄÌå»ý£¬Ìá¸ß´úÂëµÄÔËÐÐЧÂÊ¡£±¾ÎÄÌÖÂÛµÄÖ÷ÒªÊÇÈçºÎÌá¸ß´úÂëµÄЧÂÊ¡£
ÔÚJava³ÌÐòÖУ¬ÐÔÄÜÎÊÌâµÄ´ó²¿·ÖÔÒò²¢²»ÔÚÓÚJavaÓïÑÔ£¬¶øÊÇÔÚÓÚ³ÌÐò±¾Éí¡£Ñø³ÉºÃµÄ´úÂë±àдϰ¹ß ......
ÔÚstrutsÖÐÓкöàµÄ±êÇ©·½±ã¿ª·¢£¬±ÈÈç<logic:iterate>±êÇ©£¬¿ÉÒԺܺõÄÏÔʾlistµÄÄÚÈÝ£º
£¨Ò»£©¶ÔListµÄÑ»·±éÀú£º
1.Ïȶ¨ÒåÒ»¸öUserÀࣺ
import java.io.Serializable;
public final class User implements Serializable {
private String name = null;
private String password ......