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Îļþ£¬½«¸ÃÎļþ ......
½ñÌìÊÇѧϰOAϵͳµÄµÚÒ»Ì죬ÎÒ¶Ô½ñÌìµÄÉÏ¿ÎÄÚÈÝ×öÁ˼òµ¥µÄ×ܽ᣺
OA¼ò½é£º
OAÊÇOFFICE AUTOMATIONµÄËõд£¬±¾ÒâΪÀûÓü¼ÊõµÄÊÖ¶ÎÌá¸ß°ì¹«µÄЧÂÊ£¬½ø¶øʵÏְ칫µÄ×Ô¶¯»¯´¦Àí¡£²ÉÓÃInternet/Intranet¼¼Êõ£¬»ùÓÚ¹¤×÷Á÷µÄ¸ÅÄʹÆóÒµÄÚ²¿ÈËÔ±·½±ã¿ì½ÝµØ¹²ÏíÐÅÏ¢£¬¸ßЧµØÐͬ¹¤×÷£»¸Ä±ä¹ýÈ¥¸´ÔÓ¡¢µÍЧµÄÊÖ¹¤°ì¹«·½Ê½£¬ÊµÏÖѸËÙ ......
ÎÒ½ñÌìѧϰÁËÐìÀÏʦ½²µÄejb3µÄ֪ʶ£¬ÎÒ×öÁ˼òµ¥µÄ±Ê¼Ç£º
ÉÏÎç½²µÄÊÇjpaµÄ֪ʶ£¬ÏÂÎç½²µÄÊÇEJB3µÄ֪ʶ£º
JPQLÓï¾ä£ºhibernateµÄHQLÓï¾äÒ»Ñù¡£
¼òµ¥²éѯ:
Query query = em.createQuery("SELECT c from Customer c");
retur ......
ÎÒ½ñÌìѧϰÁËÐìÀÏʦ½²µÄUMLͳһ½¨Ä£ÓïÑÔ£¬ÎÒ×öÁ˼òµ¥µÄ±Ê¼Ç£º
Èí¼þÉúÃüÖÜÆÚ: Èí¼þµÄ²úÉúÖ±µ½±¨·ÏµÄÉúÃüÖÜÆÚ
Èí¼þÉúÃüÖÜÆÚÄÚÓÐÎÊÌⶨÒå, ¿ÉÐÐÐÔ·ÖÎö, ×ÜÌåÃèÊö, ϵͳÉè¼Æ,±àÂë, µ÷ÊԺͲâÊÔ, ÑéÊÕÓëÔËÐÐ, ά»¤Éý¼¶µ½·ÏÆúµÈ½×¶Î
Èí¼þ¹¤³Ì¿ÉÒÔ·ÖΪÈý¸ö´óµÄ½×¶Î:ÐèÇó; Éè¼Æ; ²âÊÔÓëά»¤
Èí¼þµÄÉúÃüÖÜÆÚÏê½â£º
ÎÊÌâµ ......
Impl
public class BaseDAOImpl extends HibernateDaoSupport implements IBaseDAO
//Ìí¼ÓÊý¾Ý
this.getHibernateTemplate().save(achi);
//ɾ³ý
this.getHibernateTemplate().delete(this.getById(achi));
//²éѯËùÓÐ
return this.getHibernateTemplate().find("from Achievement a ......