JAVA¶ÔÏóת»»ÎªXML¸ñʽ
JAVA¶ÔÏóת»»ÎªXML¸ñʽ
¼òµ¥µÄ²üÊöÏÂÈçºÎ½«JAVA¶ÔÏóת»»ÎªXML¸ñʽ£¬ÏêϸÁ˽âÇë½øÈëhttp://xstream.codehaus.org/tutorial.html
JAVABEAN¶ÔÏó
userInfo.java
private String name;
private String password;
//construtors and methods setting and getting methods
userInfoController.java
public static void mian(string args[])
{
//³õʼ»¯BEAN¶ÔÏó
userInfo userinfo=new userInfo();
userinfo.setName("Jimmy");
userinfo.setPassword("123456");
//³õʼ»¯XStream¶ÔÏó
XStream xStream=new XStream(new DomDriver);
xStream.alias("user",userInfo.class)
String xml=xStream.toXML(user);
System.out.println(xml);
}
Êä³ö½á¹ûΪ£º
<userinfo>
<name>jimmy</name>
<password>123456</password>
</userinfo>
Ïà¹ØÎĵµ£º
½ñÌìÊÇÀ´´«ÖDz¥¿ÍµÄµÚÒ»Ì죬ÐÒ¿÷֮ǰ¿´¹ýthinking in java ¸Ð¾õÀí½â²»ÊǺܳÔÁ¦£¬µ«ÊǸоõͦÀÛµÄ
1¡£Íâ¹Ò²å¼þµÄ²½Ö裺
1£¬ÔÚeclipseµÄĿ¼Ï½¨Á¢linksĿ¼¡£
2£¬ÔÚlinksĿ¼Ï£¬½¨Á¢Ò»¸öÎļþ£¬ÄÚÈÝΪ²å¼þeclipseĿ¼µÄ¸¸Ä¿Â¼£»
path=²å¼þeclipseĿ¼µÄ¸¸Ä¿Â¼ path=F:\\Eclipse\\NLpack1-eclipse-SDK-3.2.1-w ......
ÔÚXMLÎļþÖжÁÈ¡ÊôÐÔÎļþ£¨.properties£©ÖеÄÔªËØÖµ£º
web.xml
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/conf/dataAccessContext.xml</param-value>
</context-param>
<listener>
<listener-class>
......
¡¡¡¡DTDʵ¼ÊÉÏ¿ÉÒÔ¿´×÷Ò»¸ö»ò¶à¸öXMLÎļþµÄÄ£°å£¬ÕâЩXMLÎļþÖеÄÔªËØ¡¢ÔªËصÄÊôÐÔ¡¢ÔªËصÄÅÅÁз½Ê½/˳Ðò¡¢ÔªËØÄܹ»°üº¬µÄÄÚÈݵȣ¬¶¼±ØÐë·ûºÏDTDÖеĶ¨Òå¡£XMLÎļþÖеÄÔªËØ£¬¼´ÎÒÃÇËù´´½¨µÄ±ê¼Ç£¬ÊǸù¾ÝÎÒÃÇÓ¦ÓõÄʵ¼ÊÇé¿öÀ´´´½¨µÄ¡£ÏëÒª´´½¨Ò»·ÝÍêÕûÐԸߡ¢ÊÊÓ¦ÐÔ¹ãµÄDTDÊǷdz£À§Äѵģ¬ÒòΪ¸÷Ðи÷Òµ¶¼ÓÐËûÃÇ×Ô¼ºµÄÐÐÒµÌص㣠......
°²×°»·¾³£º
1.ÉÏ´«jdk-6u17-linux-i586.binºÍapache-tomcat-6.0.20.tar.gzµ½/usr
2.°²×°JDK
¡¡¡¡$chmod a+x jdk-6u17-linux-i586.bin
¡¡¡¡$ ./jdk-6u17-linux-i586.bin
¡¡¡¡$ vi /etc/profile
¡¡¡¡#Ìí¼ÓÈçÏÂ
¡¡¡¡export JAVA_HOME=/usr/jdk1.6.0_17
¡¡¡¡export PATH=$JAVA_HOME/bin:$PATH
¡¡¡¡$echo $JAVA_H ......
LombokÊÇÒ»¸ö¿ªÔ´ÏîÄ¿£¬¿ÉÒÔÓÃÀ´Ïû³ýJava´úÂëµÄÈß³¤
Ïêϸ½éÉܲο´http://www.ibm.com/developerworks/opensource/library/os-lombok/index.html
ÏÂÃæ½éÉÜLombokÈçºÎÏû³ýJava´úÂëµÄÈß³¤¡£
1. Ê×ÏÈÈ¥http://projectlombok.org/. ÏÂÔØlombok.jar °ü
2. & ......