java ·¢ËÍgetºÍpostÇëÇó
URLµÄopenConnection()·½·¨½«·µ»ØÒ»¸öURLConnection¶ÔÏ󣬸öÔÏó±íʾӦÓóÌÐòºÍ URL Ö®¼äµÄͨÐÅÁ´½Ó¡£³ÌÐò¿ÉÒÔͨ¹ýURLConnectionʵÀýÏò¸ÃURL·¢ËÍÇëÇ󡢶ÁÈ¡URLÒýÓõÄ×ÊÔ´¡£
ͨ³£´´½¨Ò»¸öºÍ URL µÄÁ¬½Ó£¬²¢·¢ËÍÇëÇ󡢶ÁÈ¡´Ë URL ÒýÓõÄ×ÊÔ´ÐèÒªÈçϼ¸¸ö²½Ö裺
£¨1£©Í¨¹ýµ÷ÓÃURL¶ÔÏóopenConnection()·½·¨À´´´½¨URLConnection¶ÔÏó¡£
£¨2£©ÉèÖÃURLConnectionµÄ²ÎÊýºÍÆÕͨÇëÇóÊôÐÔ¡£
£¨3£©Èç¹ûÖ»ÊÇ·¢ËÍGET·½Ê½ÇëÇó£¬Ê¹ÓÃconnect·½·¨½¨Á¢ºÍÔ¶³Ì×ÊÔ´Ö®¼äµÄʵ¼ÊÁ¬½Ó¼´¿É£»Èç¹ûÐèÒª·¢ËÍPOST·½Ê½µÄÇëÇó£¬ÐèÒª»ñÈ¡URLConnectionʵÀý¶ÔÓ¦µÄÊä³öÁ÷À´·¢ËÍÇëÇó²ÎÊý¡£
£¨4£©Ô¶³Ì×ÊÔ´±äΪ¿ÉÓ㬳ÌÐò¿ÉÒÔ·ÃÎÊÔ¶³Ì×ÊÔ´µÄÍ·×ֶΡ¢»òͨ¹ýÊäÈëÁ÷¶ÁÈ¡Ô¶³Ì×ÊÔ´µÄÊý¾Ý¡£
ÔÚ½¨Á¢ºÍÔ¶³Ì×ÊÔ´µÄʵ¼ÊÁ¬½Ó֮ǰ£¬³ÌÐò¿ÉÒÔͨ¹ýÈçÏ·½·¨À´ÉèÖÃÇëÇóÍ·×ֶΣº
setAllowUserInteraction£ºÉèÖøÃURLConnectionµÄallowUserInteractionÇëÇóÍ·×ֶεÄÖµ¡£
setDoInput£ºÉèÖøÃURLConnectionµÄdoInputÇëÇóÍ·×ֶεÄÖµ¡£
setDoOutput£ºÉèÖøÃURLConnectionµÄdoOutputÇëÇóÍ·×ֶεÄÖµ¡£
setIfModifiedSince£ºÉèÖøÃURLConnectionµÄifModifiedSinceÇëÇóÍ·×ֶεÄÖµ¡£
setUseCaches£ºÉèÖøÃURLConnectionµÄuseCachesÇëÇóÍ·×ֶεÄÖµ¡£
³ý´ËÖ®Í⣬»¹¿ÉÒÔʹÓÃÈçÏ·½·¨À´ÉèÖᢻòÔö¼ÓͨÓÃÍ·×ֶΣº
setRequestProperty(String key, String value)£ºÉèÖøÃURLConnectionµÄkeyÇëÇóÍ·×ֶεÄֵΪvalue¡£ÈçÏ´úÂëËùʾ£º
conn.setRequestProperty("accept" , "*/*")
addRequestProperty(String key, String value)£ºÎª¸ÃURLConnectionµÄkeyÇëÇóÍ·×ֶεÄÔö¼ÓvalueÖµ£¬¸Ã·½·¨²¢²»»á¸²¸ÇÔÇëÇóÍ·×ֶεÄÖµ£¬¶øÊǽ«ÐÂÖµ×·¼Óµ½ÔÇëÇóÍ·×Ö¶ÎÖС£
µ±Ô¶³Ì×ÊÔ´¿ÉÓÃÖ®ºó£¬³ÌÐò¿ÉÒÔʹÓÃÒÔÏ·½·¨ÓÃÓÚ·ÃÎÊÍ·×ֶκÍÄÚÈÝ£º
Object getContent()£º»ñÈ¡¸ÃURLConnectionµÄÄÚÈÝ¡£
String getHeaderField(String name)£º»ñÈ¡Ö¸¶¨ÏìӦͷ×ֶεÄÖµ¡£
getInputStream()£º·µ»Ø¸ÃURLConnection¶ÔÓ¦µÄÊäÈëÁ÷£¬ÓÃÓÚ»ñÈ¡URLConnectionÏìÓ¦µÄÄÚÈÝ¡£
getOutputStream()£º·µ»Ø¸ÃURLConnection¶ÔÓ¦µÄÊä³öÁ÷£¬ÓÃÓÚÏòURLConnection·¢ËÍÇëÇó²ÎÊý¡£
×¢Ò⣺Èç¹û¼ÈҪʹÓÃÊäÈëÁ÷¶ÁÈ¡URLConnectionÏìÓ¦µÄÄÚÈÝ£¬Ò²ÒªÊ¹ÓÃÊä³öÁ÷·¢ËÍÇëÇó²ÎÊý£¬Ò»¶¨ÒªÏÈʹÓÃÊä³öÁ÷£¬ÔÙʹÓÃÊäÈëÁ÷¡£
getHeaderField·½·¨ÓÃÓÚ¸ù¾ÝÏìӦͷ×Ö¶ÎÀ´·µ»Ø¶ÔÓ¦µÄÖµ¡£¶øijЩͷ×Ö¶ÎÓÉÓÚ¾³£ÐèÒª·ÃÎÊ£¬ËùÒÔJavaÌṩÁËÒÔÏ·½·¨À´·ÃÎÊÌض¨ÏìӦͷ×ֶεÄÖµ£º
getContentEncoding£
Ïà¹ØÎĵµ£º
(×¢Ò⣺ÏÂÃæÎļþ¶¼ÔÚf:\myjavaÖУ©
{
3¸öÔ´Îļþ£ºMyApp.java,MyLib.java,PrintSchool.java;
½¨Îļþ¼Ðorg\Jie
ÆäÖÐMyLibºÍPrintSchool·ÅÔÚ°üorg.JieÖУ¨import org.Jie)
ÔÚcmd.exeÖÐÔËÐÐ
javac -d org\Jie MyLib.java //ÔÚorg\Jie\org\jieÉú³ÉÁËMyLib.classÎļþ£¬½«¸ÃÎļþ ......
ÎÒ½ñÌìѧϰÁËÐìÀÏʦ½«µÄhibernate¿ò¼Ü֪ʶ£¬ÎÒ×öÁ˼òµ¥µÄ±Ê¼Ç£º
¼¯ºÏÊôÐÔ´óÖ·ÖΪ¶þÖÖ£º
µ¥´¿µÄ¼¯ºÏÊôÐÔ£¬ÏñList,Set»òÊý×éµÈ¼¯ºÏÊôÐÔ¡£
2,Map¼¯ºÏÊôÐÔ£¬Ã¿¸öÊôÐÔÖµ¶àÓÐÏà¶ÔÓ¦µÄKeyÓ³Éä¡£
&nb ......
ÎÒ½ñÌìѧϰÁËluceneµÄһЩ֪ʶ£¬ÎÒ×öÁ˼òµ¥µÄ±Ê¼Ç£º
Ë÷ÒýÎļþ½á¹¹£º
µ¹ÅÅË÷Òý£¬Ë÷Òý¶ÔÏóÊÇÎĵµÖеĵ¥´ÊµÈ£¬ÓÃÀ´´æ´¢ÕâЩµ¥´ÊÔÚÒ»¸öÎĵµÖеÄλÖá£ÀýÈ磬ÓÐЩÊéÔÚ×îºóÌṩµÄË÷Òý£¨µ¥´Ê——Ò³ÂëµÄ¶ÔÓ¦ÁÐ±í£©£¬¾Í¿ÉÒÔ¿´³ÉÊÇÒ»ÖÖµ¹ÅÅÐòË÷Òý¡£¿ÉÒÔͨ¹ýһЩ¹Ø¼ü×Ö£¬ÔÚÈ«ÊéÖмìË÷³öÓëÖ®Ïà¹ØµÄ²¿
Ë÷ÒýÎ ......
ÎÒ½ñÌìѧϰÁËjbpmµÄ֪ʶ£ºÎÒ×öÁ˼òµ¥µÄÕªÒª£º
Á÷³ÌͼÖеĸ÷ÖÖ½ÚµãµÄ×÷Óü°Ó÷¨£º
ÐèÒªÓв»Í¬ÀàÐÍ£¨×÷Ó㩵Ľڵ㣬²ÅÄÜÉè¼Æ³ö¸´ÔÓµÄÁ÷³Ìͼ¡£JbpmÓÐÒ»Ì×Ô¤Ïȶ¨ÒåºÃµÄ½ÚµãÀàÐÍ¡£Èç¹û²»¹»Óã¬Ò²¿ÉÒÔʹÓÃ×Ô¶¨Òå½Úµã½øÐÐÀ©Õ¹£¬ÒÔÍê³É²»Í¬µÄÁ÷³ÌµÄÐèÒª¡£²»Í¬µÄ½ÚµãÀàÐÍ´ú±í²»Í¬µÄÐÐΪ¡£
ÿ¸öÁ÷³Ì¶¼±ØÐëÒªÓп ......
ÎÒ½ñÌìѧϰÁËÐìÀÏʦ½²µÄejb3µÄ֪ʶ£¬ÎÒ×öÁ˼òµ¥µÄ±Ê¼Ç£º
ÉÏÎç½²µÄÊÇjpaµÄ֪ʶ£¬ÏÂÎç½²µÄÊÇEJB3µÄ֪ʶ£º
JPQLÓï¾ä£ºhibernateµÄHQLÓï¾äÒ»Ñù¡£
¼òµ¥²éѯ:
Query query = em.createQuery("SELECT c from Customer c");
retur ......