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

Tomcat java ¶¨Ê±ÈÎÎñ

Á½¸ötomcat Java¶¨Ê±ÈÎÎñµÄÀý×Ó
ÀýÒ»£º
±¾ÀýÒÀ¾ÝJava×ÔÉíÌṩµÄ½Ó¿ÚʵÏÖ£¬Í¨¹ý¼àÌýÆ÷£¨Listener£©ºÍ¶¨Ê±Æ÷£¨Timer£©¶¨Ê±Ö´ÐÐij¸öÈÎÎñ£¨Task£©¡£
רҵµÄ¿ªÔ´¹¤¾ß¿É²Î¿¼Quartz£ºhttp://www.opensymphony.com/quartz/
MyListener£º
import
 java.util.Timer;
import
 javax.servlet.ServletContextEvent;
import
 javax.servlet.ServletContextListener;
public
 
class
 MyListener 
implements
 ServletContextListener {
  
  
private
 Timer timer 
=
 
null
;
  
public
 
void
 contextInitialized(ServletContextEvent event) {
    timer 
=
 
new
 Timer(
true
);
    
//
ÉèÖÃÈÎÎñ¼Æ»®£¬Æô¶¯ºÍ¼ä¸ôʱ¼ä
    timer.schedule(
new
 MyTask(), 
0

86400000
);
  }
  
public
 
void
 contextDestroyed(ServletContextEvent event) {
    timer.cancel();
  }
  
}
MyTask£º
import
 java.util.TimerTask;
public
 
class
 MyTask 
extends
 TimerTask {
  
public
 
void
 run() {
    
//
 System.out.println("call at " + (new Date()));
    
//
 TODO ´Ë´¦Ìí¼Ó¾ßÌåÈÎÎñ´úÂë
  }
}
web.xmlÅäÖãº
<
listener
>
<
listener-class
>
com.fastunit.samples.listener.MyListener
</
listener-class
>
</
listener
>
Àý¶þ
ÈçºÎÔÚWeb¹¤³ÌÖÐʵÏÖÈÎÎñ¼Æ»®µ÷¶È  
   
         
ÏÂÃæ¾ÍServletÕìÌýÆ÷½áºÏJava¶¨Ê±Æ÷À´½²ÊöÕû¸öʵÏÖ¹ý³Ì¡£ÒªÔËÓÃServletÕìÌýÆ÷ÐèҪʵÏÖ
javax.servlet.ServletContextListener½Ó¿Ú£¬Í¬Ê±ÊµÏÖËüµÄ
contextInitialized(ServletContextEvent  
event)ºÍcontextDestroyed(ServletContextEvent  
event)Á½¸ö½Ó¿Úº¯Êý¡£¿¼ÂǶ¨


Ïà¹ØÎĵµ£º

JavaÓïÑÔ»ù´¡(Ò»)

Ò»£¬JavaÓïÑÔÖеĶÔÏóÒýÓÃ
C++ÖÐÖ¸ÕëºÍÒýÓüæÓУ¬¶øJavaÖÐûÓÐÖ¸ÕëµÄ¸ÅÄÍêÈ«ÓÃÒýÓÃÌæ´ú¡£ÈçC++ÖÐÒ»Ñù£¬ÒýÓÃÊÇÎÒÃǸø±äÁ¿µÄÒ»¸ö“±ðÃû”£¬Ò»¸ö±äÁ¿¿ÉÒÔÓжà¸ö“±ðÃû”¡£ÒýÓõÄÖµÊÇÒ»¸öÄÚ´æµØÖ·£¬ÔÚ¶ÔÏóµÄÒýÓñ»¶¨Òåʱ£¬È磺
String s;  //´ËʱsֵΪ¿Õ£¬ÏµÍ³²¢Ã»ÓÐΪsËùÖ¸µÄ¶ÔÏó·ÖÅäÄÚ´æ
s = ......

JavaºÍC++λÔËËã¶Ô±È

ΪÁËʵÏÖÁ½¸öÊý×Ö½øÐн»»»£¬ÎÒÃÇͨ³£¿ÉÒÔÀûÓÃλÔËËãÀ´ÊµÏÖ
C++³ÌÐò     swap(int a  ,int b){a^=b^=a^=b;}
JAVA³ÌÐò    swap(int a, int b){  a^=b;b^=a;a^=b; }»òÕß{ b^=(a^=b) ; a^=b;}
Èç¹ûJAVAÓÃC++µÄʵÏÖ·½Ê½Ôò»áµÃµ½ bµÃµ½ÁËaµÄÖµ£¬µ«ÊÇaÏÖÔÚµÄֵȴ² ......

JavaÖеÄÖµ´«µÝ

 ÔÚJavaÖз½·¨²ÎÊýµÄ´«µÝ£¬¶¼ÊÇÖµ´«µÝ£¬¶ÔÏó´«µÝÊǵØÖ· £¬»ù±¾Êý¾ÝÀàÐÍ´«µÝµÄÊÇÖµ¡£µØÖ·ºÍÖµ¶¼Öµ¡£
ÏÂÃæÒÔÒ»¸öÀý×ÓÀ´¿´ÄÚ´æÖеÄÊý¾Ý±ä»¯Çé¿ö
public class Test{
  
     private String name;
    public String getName(){
     &nbs ......

J2EE·Ö²ãÉè¼ÆÊÇJavaÆóÒµÓ¦ÓõÄ×î»ù±¾µÄÉè¼Æ˼Ïë¡£


 
´Ó×î³£¹æµÄ·Ö²ã½á¹¹À´Ëµ£¬ÏµÍ³²ã´Î´ÓÉϵ½ÏÂÒÀ´ÎΪ£º
 
±íÏֲ㣺Ö÷ÒªÊÇ¿Í»§¶ËµÄչʾ¡£
 
·þÎñ²ã£ºÖ±½ÓΪ¿Í»§¶ËÌṩµÄ·þÎñ»ò¹¦ÄÜ¡£Ò²ÊÇϵͳËùÄܶÔÍâÌṩµÄ¹¦ÄÜ¡£
 
ÁìÓò²ã£ºÏµÍ³ÄÚµÄÁìÓò»î¶¯¡£
 
DAO²ã£ºÊý¾Ý·ÃÎʶÔÏó£¬Í¨¹ýÁìÓòʵÌå¶ÔÏóÀ´²Ù×÷Êý¾Ý¿â¡£
 
ÆäÖÐÓÐЩָµ¼Ô­Ôò£º
& ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ