java³£ÓõÄListener·ÖÀà
ListenerÊÇServletµÄ¼àÌýÆ÷£¬Ëü¿ÉÒÔ¼àÌý¿Í»§¶ËµÄÇëÇó¡¢·þÎñ¶ËµÄ²Ù×÷µÈ¡££¨Í¨¹ý¼àÌýÆ÷£¬¿ÉÒÔ×Ô¶¯¼¤·¢Ò»Ð©²Ù×÷£¬±ÈÈç¼àÌýÔÚÏßµÄÓû§µÄÊýÁ¿¡£µ±Ôö¼ÓÒ»¸öHttpSessionʱ£¬¾Í¼¤·¢
sessionCreated(HttpSessionEvent se)·½·¨£¬ÕâÑù¾Í¿ÉÒÔ¸øÔÚÏßÈËÊý¼Ó1¡££©
Servlet ¼àÌýÆ÷ÓÃÓÚ¼àÌýһЩÖØҪʼþµÄ·¢Éú£¬¼àÌýÆ÷¶ÔÏóÔÚÊÂÇé·¢ÉúÇ°¡¢·¢Éúºó¿ÉÒÔ×öһЩ±ØÒªµÄ´¦Àí¡£
Ä¿Ç° Servlet2.4 ºÍ JSP2.0 ³£ÓõÄÓÐ7
¸ö¼àÌýÆ÷½Ó¿Ú£¬·ÖΪ3
Àࣺ
1.
ServletÉÏÏÂÎĽøÐмàÌý£¨Application¼¶£©£º
ÓÃÓÚ¼àÌý ServletContext
¶ÔÏóµÄ´´½¨ºÍɾ³ýÒÔ¼°ÊôÐÔµÄÌí¼Ó¡¢É¾³ýºÍÐ޸ĵȲÙ×÷,¸Ã¼àÌýÆ÷ÐèÒªÓõ½ÈçÏÂÁ½¸ö½Ó¿ÚÀà:
(1)
ServletContextAttributeListener£º¼àÌý¶Ô ServletContext ÊôÐԵIJÙ×÷,±ÈÈçÔö¼Ó¡¢É¾³ý¡¢ÐÞ¸Ä
attributeAdded(ServletContextAttributeEvent
e) Ìí¼ÓÊôÐÔʱµ÷ÓÃ
attributeReplaced(ServletContextAttributeEvent
e) ÐÞ¸ÄÊôÐÔʱµ÷ÓÃ
attributeRemoved(ServletContextAttributeEvent
e) ɾ³ýÊôÐÔʱµ÷ÓÃ
(2) ServletContextListener£º¼àÌý¶Ô
ServletContext ¶ÔÏóµÄ´´½¨ºÍɾ³ý
contextInitialized(ServletContextEvent
sce) ³õʼ»¯Ê±µ÷ÓÃ
contextDestroyed(ServletContextEvent
sce) Ïú»Ùʱµ÷ÓÃ,¼´µ±·þÎñÆ÷ÖØмÓÔØʱµ÷ÓÃ
2. ¼àÌýHTTP»á»°£¨Session¼¶£©£º
ÓÃ
ÓÚ¼àÌý HTTP »á»°»î¶¯Çé¿öºÍ HTTP »á»°ÖеÄÊôÐÔÉèÖÃÇé¿ö,Ò²¿ÉÒÔ¼àÌý HTTP »á»°µÄ active ºÍ passivate
Çé¿öµÈ,¸Ã¼àÌýÆ÷ÐèÒªÓõ½Èç϶à¸ö½Ó¿ÚÀà:
(1) HttpSessionListener£º¼àÌý HttpSession µÄ²Ù×÷
sessionCreate(HttpSessionEvent
se) ³õʼ»¯Ê±µ÷ÓÃ;
&nb
Ïà¹ØÎĵµ£º
Ò»¡¢Ê²Ã´ÊÇ·´É䣺
·´ÉäµÄ¸ÅÄîÊÇÓÉSmithÔÚ1982ÄêÊ×´ÎÌá³öµÄ£¬Ö÷ÒªÊÇÖ¸³ÌÐò¿ÉÒÔ·ÃÎÊ¡¢¼ì²âºÍÐÞ¸ÄËü±¾Éí״̬»òÐÐΪµÄÒ»ÖÖÄÜÁ¦¡£ÕâÒ»¸ÅÄîµÄÌá³öºÜ¿ìÒý·¢Á˼ÆËã»ú¿ÆѧÁìÓò¹ØÓÚÓ¦Ó÷´ÉäÐÔµÄÑо¿¡£ËüÊ×Ïȱ»³ÌÐòÓïÑÔµÄÉè¼ÆÁìÓòËù²ÉÓÃ,²¢ÔÚLispºÍÃæÏò¶ÔÏó·½ÃæÈ¡µÃÁ˳ɼ¨¡£ÆäÖÐLEAD/LEAD++ ¡¢OpenC++ ¡¢MetaXaºÍOpenJavaµÈ¾ÍÊÇ»ùÓÚ·´ ......
±³¾°¼ò½é£ºKMPËã·¨ÓÃÀ´´¦Àí×Ö·û´®Æ¥ÅäµÄ¡£¸øÄãA,BÁ½¸ö×Ö·û´®£¬¼ì²éB´®ÊÇ·ñÊÇA´®µÄ×Ó´®£¬ÀàËÆÓÚJavaµÄString.indexOf("")¡£Ö®ËùÒÔ½Ð×öKMP£¬ÊÇÒòΪÕâ¸öËã·¨ÊÇÓÉKnuth¡¢Morris¡¢PrattÈý¸öÌá³öÀ´µÄ£¬È¡ÁËÕâÈý¸öÈ˵ÄÃû×ÖµÄÍ·Ò»¸ö×Öĸ¡£
ÔÀí½éÉÜ£ºÕÒµ½Æ¥Åäʧ°ÜʱµÄ×îºÏÊʵĻØÍËλÖ㬶ø²»ÊǼòµ¥µÄ»ØÍ˵½×Ó´®µÄµÚÒ»¸ö×Ö·û£¨³£¹ ......
JAVAÃæÊÔÌ⼯- -
»ù´¡ÖªÊ¶£º
1.C++»òJavaÖеÄÒì³£´¦Àí»úÖƵļòµ¥ÔÀíºÍÓ¦Óá£
µ±JAVA³ÌÐòÎ¥·´ÁËJAVAµÄÓïÒå¹æÔòʱ£¬JAVA
ÐéÄâ»ú¾Í»á½«·¢ÉúµÄ´íÎó±íʾΪһ¸öÒì³£¡£Î¥·´ÓïÒå¹æÔò°üÀ¨2ÖÖÇé¿ö¡£Ò»ÖÖÊÇJAVAÀà¿âÄÚÖõÄÓïÒå¼ì²é¡£ÀýÈçÊý×éϱêÔ½½ç,»áÒý·¢
IndexOutOfBoundsException;·ÃÎÊnullµÄ¶ÔÏóʱ»áÒý·¢NullPointerExcepti ......
1.±à³Ì½ç×îÖøÃûµÄÒ»¾ä»°“Hello world!”,ÈκÎÒ»¸ö³ÌÐòÔ±Æð²½Ê±±ØÓöµÄÓï¾ä
public class HelloWorld {
public static void main(String[] args) {
// TODO Auto-generated method stub
System.out.print("Hello World!");
......
1.ʹÓÃJFrameµÄenableEventsºÍprocessWindowEvent
//Frame1.java
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class Frame1 extends JFrame {
public Frame1() {
enableEvents(AWTEvent.WINDOW_EVENT_MASK);
this.setSize(ne ......