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

java ²Ù×÷XMLÎļþ£¨Æ¬¶Î£©

//create a new Document
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
DocumentBuilder db = dbf.newDocumentBuilder();
Document d = db.newDocument();

//add root Node
Element noteuser = d.createElement("note-users");
d.appendChild(noteuser);

//add exists Node
Document readXML = db.parse(new File("c:\\note-user.xml"));
NodeList nl = readXML.getElementsByTagName("user");
for(int i = 0; i < nl.getLength(); i++)
{
Element n = d.createElement("user");
n.setAttribute("name", nl.item(i).getAttributes().getNamedItem("name").getNodeValue());
if(id !=null && id.equals(nl.item(i).getAttributes().getNamedItem("name").getNodeValue()))
{
//duplicate id (redirect to error page)
response.getWriter().print("<font color = red>duplicate id !</font>");
response.getWriter().print("      ");
response.getWriter().print("<a href = \"reg.jsp\">return to login page</a>");
return;
}
n.setAttribute("password", nl.item(i).getAttributes().getNamedItem("password").getNodeValue());
noteuser.appendChild(n);
}

//add regist Node
Element n = d.createElement("user");
n.setAttribute("name", id);
n.setAttribute("password", pwd);
noteuser.appendChild(n);

//save data to file
TransformerFactory tFactory = TransformerFactory.newInstance();
Transformer transformer = tFactory.newTransformer();
DOMSource source = new DOMSource(d);

//file's path
StreamResult result = new StreamResult(new File("c:\\note-user.xml"));
transformer.transform(source, resu


Ïà¹ØÎĵµ£º

½âÎöJavaÀàºÍ¶ÔÏóµÄ³õʼ»¯¹ý³Ì

ÀàµÄ³õʼ»¯ºÍ¶ÔÏó³õʼ»¯ÊÇ JVM ¹ÜÀíµÄÀàÐÍÉúÃüÖÜÆÚÖзdz£ÖØÒªµÄÁ½¸ö»·½Ú£¬Google ÁËÒ»±éÍøÂ磬ÓйØÀà×°ÔØ»úÖÆµÄÎÄÕµ¹ÊDz»ÉÙ£¬È»¶øÀà³õʼ»¯ºÍ¶ÔÏó³õʼ»¯µÄÎÄÕ²¢²»¶à£¬ÌرðÊÇ´Ó×Ö½ÚÂëºÍ JVM ²ã´ÎÀ´·ÖÎöµÄÎÄÕ¸üÊÇÏÊÓÐËù¼û¡£
±¾ÎÄÖ÷Òª¶ÔÀàºÍ¶ÔÏó³õʼ»¯È«¹ý³Ì½øÐзÖÎö£¬Í¨¹ýÒ»¸öʵ¼ÊÎÊÌâÒýÈ룬½«Ô´´úÂëת»»³É JVM ×Ö½ÚÂëºó£¬ ......

JAVA±Ê¼Ç£¨¶þ£©

ÔÚÀàÖж¨ÒåµÄ·½·¨ÔÚ·µ»ØÖµÇ°¼ÓÉÏstaticÐÞÊηû¾Í¿ÉÒÔÔÚmain·½·¨Öе÷ÓÃÁË¡£Èç¹û²»ÓÃstaticÄǾÍÐèÒªÔÚmain·½·¨Öд´½¨¶ÔÏó£¬Ê¹ÓöÔÏóÀ´µ÷ÓöÔÏóµÄ·½·¨¡£
public class Test{
 public static void main(String[] args){
  Test t=new Test();
  int b=1;
  int c=2;
  int[] ......

java GC Àí½â

Ò»¸öÓÅÐãµÄjava±à³Ì³ÌÐòÔ±±ØÐëÁ˽âGCµÄ¹¤×÷Ô­Àí¡¢ÈçºÎÓÅ»¯GCµÄÐÔÄÜ¡¢ÈçºÎÓëGC½øÐÐÓÐÏ޵Ľ»»¥£¬ÒòΪÓÐһЩӦÓóÌÐò¶ÔÐÔÄÜÒªÇó½Ï¸ß£¬ÀýÈçǶÈëʽϵͳ¡¢ÊµÊ±ÏµÍ³µÈ£¬Ö»ÓÐÈ«ÃæÌáÉýÄÚ´æµÄ¹ÜÀíЧÂÊ £¬²ÅÄÜÌá¸ßÕû¸öÓ¦ÓóÌÐòµÄÐÔÄÜ¡£±¾ÆªÎÄÕÂÊ×Ïȼòµ¥½éÉÜGCµÄ¹¤×÷Ô­ÀíÖ®ºó£¬È»ºóÔÙ¶ÔGCµÄ¼¸¸ö¹Ø¼üÎÊÌâ½øÐÐÉîÈë̽ÌÖ£¬×îºóÌá³öһЩjava± ......

JAVA·´ÉäС½á

1  JAVAµÄ·´Éä,Æäʵ¾ÍÊÇͨ¹ýÒ»¸öʵÀý»¯µÄ¶ÔÏó·´¹ýÀ´È¥ÕÒµ½Ò»¸öÀàµÄÍêÕûÐÅÏ¢,±ÈÈç¶ÔÓÚÈçϵÄÐÎʽ:
X x=new X();
   x.getClass().getName();
ÕâÀï¾Í»áÊä³öÕâ¸öÀàËùÔÚµÄÍêÕûÐÅÏ¢,¼´"°üÃû.ÀàÃû";
  ×î³£ÓõÄÈýÖÖʵÀý»¯CLASSÀà¶ÔÏó
Class<?> c1 = null ;  // Ö¸¶¨·ºÐÍ
  C ......

javaµ¼Èëµ¼³öexcel²Ù×÷(jxl)


±¾ÎÄת×Ôhttp://kingsui.javaeye.com/blog/154712
javaµ¼Èëµ¼³öexcel²Ù×÷(jxl)
Java½âÊÍExcelÊý¾Ý£¨jxl.jar°üµÄʹÓã©
¹Ø¼ü×Ö: java excel jxl.jar
jxl.jar °ü
ÏÂÔØµØÖ·:
http://www.andykhan.com/jexcelapi/
ÕæÊµÏÂÔØµØÖ·:
http://www.andykhan.com/jexcelapi/download.html
ÍøÕ¾É϶ÔËüµÄÌØÕ÷ÓÐÈçÏÂÃèÊö£ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ