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

JAVA ÅÀÍøÒ³ÓÃ ÀýÈç:http://www.126.com

/*
Function name: myGetHttpFile2
Description: ÅÀÍøÒ³ÓÃ
Input: URL ÀýÈç:http://www.126.com
Output: ×Ö·û´®,ÍøÒ³µÄHTML
*/
public String myGetHttpFile2(String url){
String authentication=null;
ArrayList al=new ArrayList();
String PageURL = url;
PageURL = url ;
ArrayList urlCollection=new ArrayList();
Hashtable ht=new Hashtable();
//´úÀí£¬Èç¹ûÒª´©¹ý´úÀí½«ÏÂÃæ×¢ÊÍÈ¡Ïû
//ht=System.getProperties();
//authentication = "Basic " + new sun.misc.BASE64Encoder().encode("´úÀíµÄÓû§:´úÀíµÄÃÜÂë".getBytes());
//ht.put("proxySet", "true");
//ht.put("proxyHost", "172.16.20.2");
//ht.put("proxyPort", "80");

String urlSource=PageURL;
StringBuffer htmlBuffer=new StringBuffer();
String returnStr=null;
int codeStart=0;
int codeEnd=0;
int linkCount=0;

String getURL=null;
String realURL=null;
String urlText=null;
int from=0;
int lenURL=0;
int firstLink=0;
int endLink=0;
boolean isNewsLink=false;

try
{
URL su = new URL (urlSource);
URLConnection conn = su.openConnection();
//conn.setRequestProperty("Proxy-Authorization", authentication);

InputStream imageSource=new URL(urlSource).openStream();
int ch;
while((ch=imageSource.read())>-1)
{
htmlBuffer.append((char)ch);
}
imageSource.close();
returnStr= new String(htmlBuffer);
returnStr=new String(returnStr.getBytes("ISO8859_1"),"GBK");
}
catch(Exception e)
{
}

if(returnStr!=null){
return returnStr ;
}else{
return "empty" ;
}

}



Ïà¹ØÎĵµ£º

JavaÖÐÏà¶Ô·¾¶£¬¾ø¶Ô·¾¶ÎÊÌâ×ܽá


1.»ù±¾¸ÅÄîµÄÀí½â
¾ø¶Ô·¾¶£º¾ø¶Ô·¾¶¾ÍÊÇÄãµÄÖ÷Ò³ÉϵÄÎļþ»òĿ¼ÔÚÓ²ÅÌÉÏÕæÕýµÄ·¾¶£¬(URLºÍÎïÀí·¾¶)ÀýÈ磺 C:\xyz\test.txt ´ú±íÁËtest.txtÎļþµÄ¾ø¶Ô·¾¶¡£http://www.sun.com/index.htmÒ²´ú±íÁËÒ»¸ö URL¾ø¶Ô·¾¶¡£
Ïà¶Ô·¾¶£ºÏà¶ÔÓëij¸ö»ù׼Ŀ¼µÄ·¾¶¡£°üº¬WebµÄÏà¶Ô·¾¶(HTMLÖеÄÏà¶ÔĿ¼)£¬ÀýÈ磺ÔÚ ServletÖУ ......

javaÐÔÄÜ·ÖÎö

    Ô­ÎĵØÖ·£ºhttp://www.javaeye.com/topic/626801 Ò»Ö±ÔÞ̾Sun¶Ô´ý¼¼ÊõµÄÑϽ÷ºÍÓÅÑÅ£¨¿ÉÁ¯µÄSun£©¡£Sun JDKÖÐJava¿âµÄÔ´´úÂ룬Á¬×¢ÊͶ¼ÇåÇå³þ³þ¡¢¹æ¹æ·¶·¶£¬javadoc×¢½âµÄʹÓÃҲһ˿²»¹¶£¬¶ÁÆðÀ´ºÜÊìÊæ·þ¡£Òò´Ë£¬ÔÚÈÕ³£¹¤×÷ºÍѧϰÖУ¬¾­³£¶Á¶Á Java¿âµÄÔ´´úÂ룬²»ÒàÀÖºõ£¿Èç¹ûÓöµ½¹îÒìÎÊÌ⣬Դ´úÂë ......

java²Ù×÷Excel

½«ÏÂÔغóµÄÎļþ½â°ü£¬µÃµ½jxl.jar£¬·ÅÈëclasspath£¬°²×°¾ÍÍê³ÉÁË¡£
»ù±¾²Ù×÷
Ò»¡¢´´½¨Îļþ
ÄâÉú³ÉÒ»¸öÃûΪ“²âÊÔÊý¾Ý.xls”µÄExcelÎļþ£¬ÆäÖеÚÒ»¸ö¹¤×÷±í±»ÃüÃûΪ“µÚÒ»Ò³”£¬´óÖÂЧ¹ûÈçÏ£º
´úÂ루CreateXLS.java£©£º
//Éú³ÉExcelµÄÀà
import java.io.*;
import jxl.*;
import jxl.write. ......

java±ÊÊÔ1

1. HttpSession session = request.getSession() 
ÓëHttpSession session = request.getSession(true)µÄÇø±ð£¿ 
²Î¿¼´ð°¸£º 
getSession(true)µÄº¯ÊýÔ­ÐÍΪ:£ºHttpSession session = request.getSession (Boolean create) 
Èç¹ûÓÐÓ뵱ǰµÄrequestÏȹØÁªµÄHttpSession,ÄÇô·µ»ØrequestÏà¹ØÁªµÄHttpS ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ