java HttpClient PostʵÀý
private void postMethod(String url) throws IOException
{
url = "http://www.newsmth.net/bbslogin2.php";
PostMethod postMethod = new PostMethod(url);
// ÌîÈë¸÷¸ö±íµ¥ÓòµÄÖµ
NameValuePair[] data = { new NameValuePair("id", "herrapfel"),new NameValuePair("passwd", "") };
// ½«±íµ¥µÄÖµ·ÅÈëpostMethodÖÐ
postMethod.setRequestBody(data);
// Ö´ÐÐpostMethod
int statusCode = httpClient.executeMethod(postMethod);
System.out.println(" status code:" + statusCode);
// HttpClient¶ÔÓÚÒªÇó½ÓÊܺó¼Ì·þÎñµÄÇëÇó£¬ÏóPOSTºÍPUTµÈ²»ÄÜ×Ô¶¯´¦Àíת·¢
if(statusCode == HttpStatus.SC_OK)
{
StringBuffer contentBuffer = new StringBuffer();
InputStream in = postMethod.getResponseBodyAsStream();
BufferedReader reader = new BufferedReader(new InputStreamReader(in,postMethod.getResponseCharSet()));
String inputLine = null;
while((inputLine = reader.readLine()) != null)
{
contentBuffer.append(inputLine);
System.out.println("input line:"+ inputLine);
contentBuffer.append("/n");
}
in.close();
}
else if (statusCode == HttpStatus.SC_MOVED_PERMANENTLY || statusCode == HttpStatus.SC_MOVED_TEMPORARILY)
{
// ´
Ïà¹ØÎĵµ£º
ÔÚÁ˽âJavaµÄͬ²½ÃØÃÜ֮ǰ£¬ÏÈÀ´¿´¿´JMM(Java Memory Model)¡£
Java±»Éè¼ÆΪ¿çƽ̨µÄÓïÑÔ£¬ÔÚÄÚ´æ¹ÜÀíÉÏ£¬ÏÔȻҲҪÓÐÒ»¸öͳһµÄÄ£ÐÍ¡£¶øÇÒJavaÓïÑÔ×î´óµÄÌصã¾ÍÊǷϳýÁËÖ¸Õ룬°Ñ³ÌÐòÔ±´ÓÍ´¿àÖнâÍѳöÀ´£¬²»ÓÃÔÙ¿¼ÂÇÄÚ´æʹÓú͹ÜÀí·½ÃæµÄÎÊÌâ¡£
¿ÉϧÊÀÊÂ×ܲ»¾¡ÈçÈËÒ⣬ËäÈ»JMMÉè¼ÆÉÏ·½±ãÁ˳ÌÐòÔ±£¬µ«ÊÇËüÔö¼ÓÁËÐéÄâ»úµÄ¸ ......
Ãô½Ý¿ª·¢µÄÀíÄîÒѾÁ÷ÐÐÁ˺ܳ¤µÄʱ¼ä£¬ÔÚÃô½Ý¿ª·¢ÖеĿª·¢µü´ú½×¶ÎÖУ¬ÎÒÃÇ¿ÉÒÔͨ¹ýÎå¸ö²½Ö裬À´ÓÐЧµÄÌá¸ßÕû¸öÏîÄ¿µÄ´úÂëÖÊÁ¿¡£
JavaÏîÄ¿¿ª·¢¹ý³ÌÖУ¬ÓÉÓÚ¿ª·¢ÈËÔ±µÄ¾Ñé¡¢Java´úÂë±àдϰ¹ß£¬ÒÔ¼°È±·¦Í³Ò»µÄ±ê×¼ºÍ¹ÜÀíÁ÷³Ì£¬ÍùÍùµ¼ÖÂÕû¸öÏîÄ¿µÄ´úÂëÖÊÁ¿½Ï²î£¬ÄÑÓÚά »¤£¬ÐèÒª½Ï´óµÄ²âÊÔͶÈëºÍÖÜÆÚµÈÎÊÌâ¡£ÕâЩÎÊÌâÔÚÒ»¸öÏ ......
JAVA--java.io.InvalidClassException¼±½â
×ֺţºT|T
JAVA--java.io.InvalidClassException¼±½â
java.io.InvalidClassException: message.RegisterMessage; local class incompatible: stream classdesc serialVersionUID = 5540404719929042644, local class serialVersionUID = -8915824483106432775
»Ø´ð£º
×î¼Ñ ......
JAVAÕýÔò±í´ïʽ--PatternºÍMatcher
×÷Õߣº³Â¹ã¼Ñ ÎÄÕÂÀ´Ô´£ºwww.fooldock.com
·¢²¼ÈÕÆÚ£º2004Äê11ÔÂ19ÈÕ ä¯ÀÀ´ÎÊý£º2585´Î
ÏÖÔÚJDK1.4ÀïÖÕÓÚÓÐÁË×Ô¼ºµÄÕýÔò±í´ïʽAPI°ü£¬JAVA³ÌÐòÔ±¿ÉÒÔÃâÈ¥ÕÒµÚÈý·½ÌṩµÄÕýÔò±í´ïʽ¿âµÄÖÜÕÛÁË£¬ÎÒÃÇÏÖÔÚ¾ÍÂíÉÏÀ´Á˽âÒ»ÏÂÕâ¸öSUNÌṩµÄ³Ù ......