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

Java XStream·â×°Àà

´Ë¸öÀàÊÇΪÁË·½±ã³õѧÕß¶ÔXMLµ½ javabean µÄÏ໥ת»»²»ÊìϤ¶øÐ´µÄ:
import com.thoughtworks.xstream.XStream;
import com.thoughtworks.xstream.io.xml.DomDriver;
public class XmlBean {
 /*
  * @AUTHOR:ZHONG
  * @CREATETIME:2010/02/10
  * @PREAM:OBJECT(JAVABEAN)
  * @RETURN:XML STRING
  */
 public static String GenerateXML(Object model){
  
  XStream xstream = new XStream(new DomDriver());
  //ת»»³É xml ¸ñʽ  
  String xml = xstream.toXML(model);
  return xml;
 }
 /*
  * @AUTHOR:ZHONG
  * @CREATETIME:2010/02/10
  * @PREAM:STRING(XML)
  * @RETURN:(javabean)OBJECT
  */
 public static Object fromXML(String xmlString){
  XStream xs = new XStream(new DomDriver());
     Object ob = xs.fromXML(xmlString);
     System.out.println(ob);
     return ob;
 }
ʹÓÃʵÀý:
public static void main(String[] args) {
  
  UserBean user = new UserBean();
  user.setUsername("zhongshulin");
  user.setPassword("123456");
  user.setEmail("zhong@shulin.com");
  user.setPhone("123456789");
  user.setAddress("Ö麣ƷÉÐ");
  String xml = GenerateXML(user);
  user =(UserBean)fromXML(xml);
  String  userName = user.getUsername();
  String  pass = user.getPassword();
  String  email = user.getEmail();
  String  phone = user.getPhone();
  String address = user.getAddress();
  
 }


Ïà¹ØÎĵµ£º

XULRunner with Java: JavaXPCOM Tutorial 5

7.3 µã»÷ElementºÍÌîд±íµ¥
    ÎÒÃÇ¿ÉÒÔ°²È«µÄ¼ÓÔØÒ³Ãæ£¬³éÈ¡ÐÅÏ¢£¬µ«ÊÇÓÐʱä¯ÀÀÍøÒ³ÊÇÐèÒªÌîд±íµ¥²¢Ìá½»»òÕßµã»÷ij¸öÔªËØÀ´´¥·¢onclickÒÔ±ãÖ´ÐÐÒ»¶Î
JavaScript´úÂë¡£
    àÅ£¬ÒªÏëµã»÷Ò»¸öelementÐèÒª»ñµÃÕâ¸öelement(Ç°ÃæµÄxpathNodesÒ²Ðí¿ÉÒÔ°ïÎÒÃÇ×öµ½Õâµã)£¬Èç¹ûÊÇinput element£ ......

ʹÓÃjava½«ÍøÒ³±£´æÎªmht¸ñʽ

¿ÉÒÔÓÃ×öcsdn±¸·Ý£¬Õâ¸ö·½·¨À©³äÒÔºó×ö¸öcsdn±¸·Ý¹¤¾ßµ¹ÊDz»´í
 
 
 
 package com.tag;
    import java.io.BufferedInputStream;
    import java.io.BufferedOutputStream;
    import java.io.BufferedReader;
    import ja ......

java UDPģʽͨѶʵÀý javaѧϰ±Ê¼Ç(5)

Ò»°ãʹÓÃsocket½¨Á¢µÄÁ¬½Ó¶¼ÊôÓÚTCPÁ¬½ÓµÄģʽ..¾ÍÊÇÒ»°ãҪͨ¹ýÈý´ÎÎÕÊÖÀ´½¨Á¢session..È»ºóÔÙ´«ËÍÊý¾Ý..
¶øUDPģʽ²»Í¬µÄµØ·½ÔÚÓÚ..Ëü²»ÐèÒª½¨Á¢ºÍËûÈ˵ÄÁ¬½Ó..¶øÊÇÖ±½ÓÍùһ̨Ö÷»úµÄijһ¸ö¶Ë¿ÚÉÏ·¢ËÍÊý¾Ý±¨ÎÄ..
¶ÔÓÚһЩ¶ÔͨÐÅÖÊÁ¿ÒªÇ󲻸߻òÕß˵Êý¾ÝÏ¡ÊèµÄͨÐÅÀ´Ëµ..ÓÃUDPģʽÊÇÒ»¸ö²»´íµÄÑ¡Ôñ..
ÏÂÃæÊÇÒ»¸öÓÃjavaÊµÏ ......

JAVAÖÐintתStringÀàÐÍЧÂʱȽÏ

´ó¼Ò¶¼ÖªµÀJAVAÖÐ int ÀàÐÍҪת»¯³É String ÀàÐÍ£¬¿ÉÒÔÓÐÈýÖÖ·½Ê½£¬·Ö±ðÊÇ£º
* (1) String.valueOf(i)
* (2) Integer.toString(i)
* (3) i+""
ÒòΪǰÁ½Ì죬дһ¸ö³ÌÐòʱ£¬ÒªÓõ½ int ת String ,²¢ÇÒÊý¾ÝÁ¿ºÜ´ó£¬Òò´ËÏë¿´¿´ÕâÈýÖÖ·½Ê½µÄЧÂÊÔõÑù£¬Ð´ÁËһϼòµ¥µÄ²âÊÔ³ÌÐò£¬Ôڴ˼ǼһÏ¡£
Java´úÂë
public clas ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ