JavaÎļþ²Ù×÷´óÈ«£¨Æߣ©
45.ÑéÖ¤Schema
//import java.io.*;
//import javax.xml.parsers.*;
//import org.xml.sax.*;
//import org.w3c.dom.*;
String xsdFileName = \"Q:\\\\_dev_stu\\\\xsdtest\\\\src\\\\note.xsd\";
try {
//´´½¨Ä¬ÈϵÄXML´íÎó´¦ÀíÆ÷
XMLErrorHandler errorHandler = new XMLErrorHandler();
//»ñÈ¡»ùÓÚ SAX µÄ½âÎöÆ÷µÄʵÀý
SAXParserFactory factory = SAXParserFactory.newInstance();
//½âÎöÆ÷ÔÚ½âÎöʱÑéÖ¤ XML ÄÚÈÝ¡£
factory.setValidating(true);
//Ö¸¶¨ÓÉ´Ë´úÂëÉú³ÉµÄ½âÎöÆ÷½«Ìṩ¶Ô XML Ãû³Æ¿Õ¼äµÄÖ§³Ö¡£
factory.setNamespaceAware(true);
//ʹÓõ±Ç°ÅäÖõŤ³§²ÎÊý´´½¨ SAXParser µÄÒ»¸öÐÂʵÀý¡£
SAXParser parser = factory.newSAXParser();
//´´½¨Ò»¸ö¶ÁÈ¡¹¤¾ß
SAXReader xmlReader = new SAXReader();
//»ñȡҪУÑéxmlÎĵµÊµÀý
Document xmlDocument = (Document) xmlReader.read(new File(xmlFileName));
//ÉèÖà XMLReader µÄ»ù´¡ÊµÏÖÖеÄÌض¨ÊôÐÔ¡£ºËÐŦÄܺÍÊôÐÔÁбí¿ÉÒÔÔÚ [url]http://sax.sourceforge.net/?selected=get-set[/url] ÖÐÕÒµ½¡£
parser.setProperty(
\"http://java.sun.com/xml/jaxp/properties/schemaLanguage",
\"http://www.w3.org/2001/XMLSchema");
parser.setProperty(
\"http://java.sun.com/xml/jaxp/properties/schemaSource",
\"file:\" + xsdFileName);
//´´½¨Ò»¸öSAXValidatorУÑ鹤¾ß£¬²¢ÉèÖÃУÑ鹤¾ßµÄÊôÐÔ
SAXValidator validator = new SAXValidator(parser.getXMLReader());
//ÉèÖÃУÑ鹤¾ßµÄ´íÎó´¦ÀíÆ÷£¬µ±·¢Éú´íÎóʱ£¬¿ÉÒÔ´Ó´¦ÀíÆ÷¶ÔÏóÖеõ½´íÎóÐÅÏ¢¡£
validator.setErrorHandler(errorHandler);
//УÑé
validator.validate(xmlDocument);
XMLWriter writer = new XMLWriter(OutputFormat.createPrettyPrint());
//Èç¹û´íÎóÐÅÏ¢²»Îª¿Õ£¬ËµÃ÷УÑéʧ°Ü£¬´òÓ¡´íÎóÐÅÏ¢
Ïà¹ØÎĵµ£º
JAVA¶¨Ê±Ö´ÐÐÈÎÎñµÄÈýÖÖ·½·¨
1) java.util.Timer
Õâ¸ö·½·¨Ó¦¸ÃÊÇ×î³£Óõģ¬²»¹ýÕâ¸ö·½·¨ÐèÒªÊÖ¹¤Æô¶¯ÄãµÄÈÎÎñ£º
Timer timer=new Timer();
timer.schedule(new ListByDayTimerTask(),10000,86400000);
ÕâÀïµÄListByDayTimerTaskÀà±ØÐëextends TimerTaskÀïÃæµÄrun()·½·¨¡£
2) ServletContextListener
Õâ¸ö·½·¨ ......
Ctrl+1 ¿ìËÙÐÞ¸´(×î¾µäµÄ¿ì½Ý¼ü,¾Í²»Óöà˵ÁË)
Ctrl+D: ɾ³ýµ±Ç°ÐÐ
Ctrl+Alt+↓ ¸´ÖƵ±Ç°Ðе½ÏÂÒ»ÐÐ(¸´ÖÆÔö¼Ó)
Ctrl+Alt+↑ ¸´ÖƵ±Ç°Ðе½ÉÏÒ»ÐÐ(¸´ÖÆÔö¼Ó)
Alt+↓ µ±Ç°ÐкÍÏÂÃæÒ»Ðн»»¥Î»ÖÃ(ÌرðʵÓÃ,¿ÉÒÔÊ¡È¥ÏȼôÇÐ,ÔÙÕ³ÌùÁË)
Alt+↑ µ±Ç°ÐкÍÉÏÃæÒ»Ðн»»¥Î»ÖÃ(ͬÉÏ)
Alt+← Ç°Ò»¸ö±à¼µ ......
Ïà¶Ô·¾¶µÄ»ñµÃ
¡¡¡¡ ˵Ã÷:Ïà¶Ô·¾¶(¼´²»Ð´Ã÷ʱºòµ½µ×Ïà¶ÔË)¾ù¿Éͨ¹ýÒÔÏ·½Ê½»ñµÃ£¨²»ÂÛÊÇÒ»°ãµÄjavaÏîÄ¿»¹ÊÇwebÏîÄ¿£©
¡¡¡¡ String
relativelyPath=System.getProperty("user.dir");
¡¡¡¡
ÉÏÊöÏà¶Ô·¾¶ÖУ¬javaÏîÄ¿ÖеÄÎļþÊÇÏà¶ÔÓÚÏîÄ¿µÄ¸ùĿ¼
¡¡¡¡ webÏîÄ¿ÖеÄÎļþ·¾¶ÊÓ²»Í¬µÄweb·þÎñÆ÷²»Í¬¶ø²»Í¬£¨tomcatÊÇ ......
11.дÈëÊôÐÔ
//import java.io.*;
File filereadonly=new File(%%1);
try {
boolean b=filereadonly.setReadOnly();
}
catch (Exception e) {
System.out.println("¾Ü¾øд·ÃÎÊ£º"+e.printStackTrace());
}
12.ö¾ÙÒ»¸öÎļþ¼ÐÖеÄËùÓÐÎļþ
//import  ......
26.Òƶ¯Ò»¸öÎļþ¼ÐÏÂËùÓÐÎļþµ½ÁíÒ»¸öĿ¼
//import java.io.*;
File movefile=new File(%%1);
File[] movefiles=movefile.listFiles();
for(int i=0;i<movefiles.length;i++){
if(movefiles[i].isFile()){
int bytesum = 0;
int byteread  ......