java webÖж¨Ê±Æ÷µÄÔËÓÃ
ÔÚ×öweb¿ª·¢µÄʱºò£¬¾³£ÐèÒªÔÚÒ»¶¨µÄʱ¼äÈ¥¸úÐÂijЩ¶«Î÷£¬»òÊǼÓÔØijЩ¶«Î÷£¬Õâ¾ÍÓõ½Á˶¨Ê±Æ÷¡£
µ±Web¹¤³ÌÆô¶¯Ê±£¬¶¨Ê±Æ÷ÄÜ×Ô¶¯¿ªÊ¼¼Æʱ£¬ÔÚÕû¸öWeb¹¤³ÌµÄÉúÃüÆÚÀ¶¨Ê±Æ÷ÿ¹ýÒ»¶Îʱ¼ä¾ÍÖ´ÐÐÒ»´Î£¬ËùÒÔ¿¼ÂǶ¨Ê±Æ÷´æ·ÅµÄλÖá£
¶¨Ê±Æ÷¿Ï¶¨²»Äܲ»Äܼòµ¥µÄ´æÔÚÓÚµ¥¸öServlet»òJavaBeanÖУ¬±ØÐëÄÜÈö¨Ê±Æ÷ËÞÖ÷µÄ´æ»îÆÚΪÕû¸öWeb¹¤³ÌÉúÃüÆÚ£¬ÔÚ¹¤³ÌÆô¶¯Ê±ÄÜ×Ô¶¯¼ÓÔØÔËÐС£½áºÏÕâÁ½µã£¬¸ú ServletÉÏÏÂÎÄÓйصÄÕìÌýÆ÷¾Í×îºÏÊʲ»¹ýÁË£¬Í¨¹ýÔÚ¹¤³ÌµÄÅäÖÃÎļþÖмÓÒÔºÏÀíÅäÖ㬻áÔÚ¹¤³ÌÆô¶¯Ê±×Ô¶¯ÔËÐУ¬²¢ÔÚÕû¸ö¹¤³ÌÉúÃüÆÚÖд¦ÓÚ¼àÌý״̬¡£
ÏÂÃæ¾ÍServletÕìÌýÆ÷½áºÏJava¶¨Ê±Æ÷À´½²ÊöÕû¸öʵÏÖ¹ý³Ì£º
import java.util.Timer;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import javax.servlet.http.HttpServlet;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
/**
* @date 2010-1-14
* @author wangpeng
* ¹¦ÄÜ£º¼àÌýÆ÷£¬ÓÃÀ´ÊµÏÖ¼ÆʱÆ÷
*/
public class ContextListener extends HttpServlet implements
ServletContextListener {
/**
*
*/
private static final long serialVersionUID = 1L;
private static final Log log = LogFactory.getLog(NewsTimerTask.class);
public ContextListener() {
}
private Timer timer = null;
public void contextInitialized(ServletContextEvent event) {
timer = new Timer(true);
log.info("¶¨Ê±Æ÷ÒÑÆô¶¯");
timer.schedule(new NewsTimerTask(event.getServletContext()),
TIME_NEWS_DELAY, TIME_NEWS_PERIOD);
log.info("ÒѾÌí¼ÓÈÎÎñµ÷¶È±í");
}
public void contextDestroyed(ServletContextEvent event) {
timer.cancel(); //¶¨Ê±Æ÷µÄÏú»Ù
log.info("¶¨Ê±Æ÷Ïú»Ù");
}
}
NewsTimerTask- ËùÒª°²ÅŵÄÈÎÎñ¡£ TIME_NEWS_DELAY - Ö´ÐÐÈÎÎñÇ°µÄÑÓ³Ùʱ¼ä£¬µ¥Î»ÊǺÁÃë¡£ Ϊ0ʱ±íÃ÷²»ÑÓ³ÙTIME_NEWS_PERIOD - Ö´Ðи÷ºóÐøÈÎÎñÖ®¼äµÄʱ¼ä¼ä¸ô£¬µ¥Î»ÊǺÁÃë¡£
NewsTimerTask¼Ì³ÐTimerTask
TimerTaskÊÇ ÓÉ Timer °²ÅÅΪһ´ÎÖ´Ðлò
Ïà¹ØÎĵµ£º
Ïֽ׶ÎJAVA²Ù×÷ExcelµÄJARÖ÷ÒªÓÐapache µÄ POI¼° JXL.
ÒòΪÏÖÔÚµÄeclipse²Ù×÷excelÓõIJå¼þΪjxl£¬ËùÒÔÔÚÏîÄ¿ÖоÍʹÓÃÁËjxl£®
ÏëÏëÁ½Õ߶¼²î²»ÁËÌ«¶à£®
´Ë¼òµ¥ÏµÁÐΪÁ½¸ö²¿·Ö£¬Ò»ÊÇAPIϵÁУ¨ÔÙ¹ÙÍøhttp://www.andykhan.com/jexcelapi/download.html¿ÉÒÔÖ±½ÓÏÂÔØ£©£¬
ÁíÒ»²¿·ÖÔòÊÇÓ¦ÓÃϵÁУ®
ÔÚÕâÀïÏÈÕÒÁ˸öÀý×Ó¸ø´ó¼Ò£ ......
Servlet/JSP¼¼ÊõºÍASP¡¢PHPµÈÏà±È£¬ÓÉÓÚÆä¶àÏß³ÌÔËÐжø¾ßÓкܸߵÄÖ´ÐÐЧÂÊ¡£ÓÉÓÚServlet/JSPĬÈÏÊÇÒÔ¶àÏß³ÌģʽִÐеģ¬ËùÒÔ£¬ÔÚ±àд´úÂëʱÐèÒª·Ç³£Ï¸Öµؿ¼ÂǶàÏ̵߳ݲȫÐÔÎÊÌ⡣Ȼ¶ø£¬ºÜ¶àÈ˱àдServlet/JSP³ÌÐòʱ²¢Ã»ÓÐ×¢Òâµ½¶àḬ̈߳²È«ÐÔµÄÎÊÌ⣬ÕâÍùÍùÔì³É±àдµÄ³ÌÐòÔÚÉÙÁ¿Óû§·ÃÎÊʱûÓÐÈκÎÎÊÌ⣬¶øÔÚ²¢·¢Óû§ÉÏÉýµ ......
Èç¹ûҪʹÖ÷´°¿Ú ¾ÓÖÐÒ»°ãʹÓÃÏÂÃæµÄ·½·¨£º
import javax.swing.*;
import java.awt.*;
public class ToCenter
{
public ToCenter(JFrame frame)
{
//---------------------------ÉèÖô°¿Ú¾ÓÖÐ---------------------------------------------------- ......
ÿ¸öÈ˵Äѧϰ·½·¨ÊDz»Í¬µÄ£¬Ò»¸öÈ˵ķ½·¨²»¼ûµÃÊʺÏÁíÒ»¸öÈË£¬ÎÒÖ»ÄÜÊÇ̸×Ô¼ºµÄѧϰ·½·¨¡£ÒòΪÎÒѧϰJavaÊÇÍêÈ«×ÔѧµÄ£¬´ÓÀ´Ã»ÓÐÎʹý±ðÈË£¬ËùÒÔѧϰµÄ¹ý³Ì»ù±¾ÉÏÍêÈ«ÊÇ×Ô¼ºÃþË÷³öÀ´µÄ¡£ÎÒÒ²²»ÖªµÀÕâÖÖ·½·¨ÊÇ·ñÊDZȽϺõķ½·¨£¬Ö»Äܸø´ó¼ÒÌṩһµã²Î¿¼ÁË¡£
ѧϰJavaµÄµÚÒ»²½ÊÇ°²×°ºÃJDK£¬Ð´Ò»¸öHello World£¬ ÆäʵJ ......