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

Java±à³Ì£ºÊµÀý·ÖÎöJ2MEÍøÂç±à³ÌµÄÁ½ÖÖ·½·¨


ºËÐÄÌáʾ£º±¾ÎÄÃèÊöÁËÔÚJ2meÖпª·¢Ö÷ҪʹÓõÄÍøÂçÁ¬½Ó·½·¨£¬·Ö±ðÏêϸ½éÉÜÁËʹÓÃhttpºÍsocketÁ½ÖÖ·½·¨¡£ HttpConnection Ê×ÏÈÎÒÃÇÏÈÀ´¿´Ò»¸ö¼òµ¥µÄÀý×Ó°É£º Ö÷ÒªÓõ½µÄjava°ü£º javax.microedition.io.*; public String requestGET(String URLString,String URL) throws
±¾ÎÄÃèÊöÁËÔÚJ2meÖпª·¢Ö÷ҪʹÓõÄÍøÂçÁ¬½Ó·½·¨£¬·Ö±ðÏêϸ½éÉÜÁËʹÓÃhttpºÍsocketÁ½ÖÖ·½·¨¡£
 HttpConnection
 Ê×ÏÈÎÒÃÇÏÈÀ´¿´Ò»¸ö¼òµ¥µÄÀý×Ó°É£º
Ö÷ÒªÓõ½µÄjava°ü£º
 javax.microedition.io.*;
 public¡¡String¡¡requestGET(String¡¡URLString,String¡¡URL)¡¡throws¡¡IOException{
//¡¡=====================================
//¡¡URLStringÊÇHTTPµØÖ·£¬URLΪºóÃæµÄ²ÎÊý
//¡¡ÕâÀïµÄÀý×ÓÊÇ·¢ËÍÓõÄÓû§ÃûºÍÃÜÂëµ½·þÎñÆ÷¶Ë½øÐÐÓû§ÑéÖ¤
//¡¡±ÈÈç¡¡String¡¡URLString¡¡=¡¡"http://192.168.0.1:8080/login.jsp";
//¡¡String¡¡URL¡¡=¡¡"?Name="+this.txtName+"&Pass="+this.txtPass
//¡¡=====================================
HttpConnection¡¡hpc¡¡=¡¡null;
DataInputStream¡¡dis¡¡=¡¡null;
boolean¡¡newline¡¡=¡¡false;
String¡¡content¡¡=¡¡"";
try{
//¡¡=====================================
//¡¡½¨Á¢Á¬½Ó
//¡¡=====================================
hpc¡¡=¡¡(HttpConnection)Connector.open(URLString+URL);
hpc.setRequestMethod(HttpConnection.GET);
dis¡¡=new¡¡DataInputStream(hpc.openInputStream());
int¡¡character;
//¡¡=====================================
//¡¡¶ÁÈ¡·µ»ØµÄHTTPÄÚÈÝ
//¡¡====================================
while((character¡¡=¡¡dis.read())¡¡!=¡¡-1){
if((char)character¡¡==¡¡'\\'){
newline¡¡=¡¡true;
continue;
}
else{
if((char)character¡¡=='n'&&¡¡newline){
content¡¡+="\n";
newline¡¡=¡¡false;
}
else¡¡if(newline){
content¡¡+="\\"¡¡+(char)character;
newline¡¡=¡¡false;
}
else{
content¡¡+=(char)character;
newline¡¡=¡¡false;
}
}
}
}
catch(IOException¡¡e){
System.out.print("ERROR:"+e);
}
finally{
if(hpc¡¡!=¡¡null){
hpc.close();
hpc¡¡=¡¡null;
}
if(dis¡¡!=¡¡null){
dis.close();
}
}
//¡¡====================================
//¡¡ÓÉÓÚÄÚÈÝ¿ÉÄÜÓÐÖÐÎÄ£¬ËùÒÔÔÚ½ÓÊܵ½ÐÅÏ¢ºóÒª¶ÔÄÚÈݽøÐÐ×Ö·û¼¯µÄת»»
//¡¡====


Ïà¹ØÎĵµ£º

Java¡¢JSP¡¢HTML¡¢XML±àд¶¼Òª·ûºÏÒÔϱàÂë¹æÔò£¡

1 ËùÓÐµÄ .java|.jsp|.html|.xml Ô´Îļþ¾ùʹÓÃutf-8±àÂë¸ñʽ±£´æµ½ÏµÍ³´ÅÅÌ¡£
È磺ÔÚEclipseÖб༭Îļþ£¬Ñ¡ÖÐÎļþ´ò¿ªÓÒ¼ü²Ëµ¥Ñ¡ÔñÊôÐÔ£¬½«Îı¾Îļþ±àÂëÉèÖÃΪÆäËû²¢Ñ¡ÔñUTF-8£»Ò²¿ÉÒÔÔÚ
Eclipse——Ê×Ñ¡Ïî——³£¹æ——ÄÚÈÝÀàÐÍÖÐÉèÖø÷ÖÖÎļþµÄȱʡ±àÂ룬ÕâÑùÒÔºóËùÓеÄÎı¾Îļþ¶¼Ê¹ÓÃÍ³Ò ......

JavaÖÐÀàÓëÀàµÄ¹Øϵ

ÀàÓëÀàÖ®¼ä´æÔÚÒÔϹØϵ£º
1¡¢ ·º»¯(Generalization)
ºÜ¼òµ¥£¬¾ÍÊÇÎÒÃdz£ËµµÄ¼Ì³Ð¡£ÊÇ˵×ÓÀà»ñµÃ¸¸ÀàµÄ¹¦ÄܵÄͬʱ£¬»¹¿ÉÒÔÀ©Õ¹×Ô¼ºµÄ¹¦ÄÜ¡£
Èçͼ:
Java´úÂëÖбíÏÖΪ£ºextends ºÍ implements
2¡¢ ÒÀÀµ(Dependency)
Á½¸öÏà¶Ô¶ÀÁ¢µÄßËßË(AºÍB)£¬µ±A¸ºÔð¹¹ÔìBʱ£¬AÓëBÐγÉÒÀÀµ¹Øϵ£¬¼´AʹÓÃB¡£
Èçͼ£º
Java´úÂëÖеıíÏÖ ......

java ÊÂÎñÏÝÚå

ÕâƪÎÄ×ÖдµÄºÜºÃ£¬ÍƼö¸ø×Ô¼ººÍ´ó¼Ò£¡
ÊÂÎñ²ßÂÔ: Á˽âÊÂÎñÏÝÚå
ÔÚ Java ƽ̨ÖÐʵÏÖÊÂÎñʱҪעÒâµÄ³£¼û´íÎó
 
 
 
¼¶±ð£º Öм¶
Mark Richards, Ö÷¹ÜºÍ¸ß¼¶¼¼Êõ¼Ü¹¹Ê¦, Collaborative Consulting, LLC
2009 Äê 3 ÔÂ 06 ÈÕ
ÊÂÎñ´¦ÀíµÄÄ¿±êÓ¦¸ÃÊÇʵÏÖÊý¾ÝµÄ¸ß¶ÈÍêÕûÐÔºÍÒ»ÖÂÐÔ¡£±¾ÎÄÊÇΪ Java ƽ̨¿ª· ......

JAVA ÈÕÆÚÏà¹Ø£¨×ªÔØ£©

/**
* ÓйØÈÕÆÚ¹¤¾ßÀà(extends TimeUtil)
*
* TimeUtilÖ÷Òª¹¦ÄÜÓУº
* 1.¸÷ÖÖÈÕÆÚÀàÐÍ£¨×Ö·û£¬util.Date£¬sql.Date£¬CalendarµÈ£©×ª»»
* 2.»ñÈ¡Ö¸¶¨ÈÕÆÚµÄÄê·Ý£¬Ô·ݣ¬ÈÕ·Ý£¬Ð¡Ê±£¬·Ö£¬Ã룬ºÁÃë
* 3.»ñÈ¡µ±Ç°/ϵͳÈÕÆÚ(Ö¸¶¨ÈÕÆÚ¸ñʽ)
* 4.»ñÈ¡×Ö·ûÈÕÆÚÒ»¸öÔµÄÌìÊý
* 5.»ñÈ¡Ö¸¶¨Ô·ݵĵÚÒ»Ìì,×îºóÒ»Ìì
*
* Date ......

JAVA¼¼ÇÉ:´ò°üwarµÄ¼¸ÖÖ·½·¨

¡¡1.Ê×ÏÈÊǹ¤¾ß±ÈÈçEclipseºÜ·½±ãÁË¡£
¡¡¡¡2.ÓÃwinrarÖ®ÀàµÄ¹¤¾ß£¬°Ñweb-infoĿ¼£¬¼°¸úËüͬ¼¶µÄËùÓÐĿ¼¼°Îļþ£¬´ò°ü³É zipÎļþ¾ÍÐÐÁË£¬È»ºó°ÑÀ©Õ¹Ãû¸Ä³Éwar!
¡¡¡¡3 JarÃüÁ
¡¡¡¡¼Ù¶¨ÓÐÒ»¸öWebÓ¦ÓãºC:\myHome
¡¡¡¡ myHome/WEB-INF/……
¡¡¡¡myHome/files/……
¡¡¡¡myHome/image/… ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ