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

JavaµÄFilter Ò»£º£¨×ªÔØ£©


 
 
¹Ø¼ü×Ö: filter
    ¹ýÂËÆ÷FilterÒ²¾ßÓÐÉúÃüÖÜÆÚ£ºinit()->doFilter()->destroy()£¬Óɲ¿ÊðÎļþÖеÄfilterÔªËØÇý¶¯¡£ÔÚservlet2.4ÖУ¬¹ýÂËÆ÷ͬÑù¿ÉÒÔÓÃÓÚÇëÇó·ÖÅÉÆ÷£¬µ«ÐëÔÚweb.xmlÖÐÉùÃ÷£¬<dispatcher>INCLUDE»òFORWARD»òREQUEST»òERROR</dispatcher>¸ÃÔªËØλÓÚfilter-mappingÖС£
Ò»¡¢ÅúÁ¿ÉèÖÃÇëÇó±àÂë
Java´úÂë
public class EncodingFilter implements Filter {   
  
    private String encoding = null;   
  
    public void destroy() {   
         encoding = null;   
     }   
  
    public void doFilter(ServletRequest request, ServletResponse response,   
             FilterChain chain) throws IOException, ServletException {   
         String encoding = getEncoding();   
        if (encoding == null){   
             encoding = "gb2312";   
         }   
         request.setCharacterEncoding(encoding);// ÔÚÇëÇóÀïÉèÖÃÉÏÖ¸¶¨µÄ±àÂë   
         chain.doFilter(request, response);   
     }   
  
    public void init(FilterConfig filterConfig) throws ServletException {   
        this.encoding = filterConfig.getInitParameter("encoding");   
     }   
  
    private String getEncoding() {   
    &nbs


Ïà¹ØÎĵµ£º

javaÈçºÎ»ñÈ¡ÕæʵµÄIP

Èç¹û·þÎñÆ÷Èç¹ûûÓвÉÓ÷´Ïò´úÀí£¬¶øÇÒ¿Í»§¶ËûÓÐÓÃÕýÏò´úÀíµÄ»°£¬
                   ÄÇô¿ÉÒÔ»ñÈ¡¿Í»§¶ËµÄÕæʵIPµØÖ·request.getRemoteAddr()
Èç¹û·þÎñÆ÷Èç¹ûûÓвÉÓ÷´Ïò´úÀí£¬¶øÇÒ¿Í»§¶ËÓÐÓÃÕýÏò´úÀíµÄ»°£¬
 &nbs ......

java ѧϰ

   ÍøÉÏ¿´µ½Ò»Ð©¸Õ¿ªÊ¼Ñ§»òÊÇ»¹Ã»ÓпªÊ¼Ñ§javaµÄͬѧ£¬¾­³£ÎÊ£º“Õâ¸öjava£¬ÎÒ¸ÃÔõôѧ£¬Ñ§Ê²Ã´ÄØ£¿”£¬ÎÒÏë¸øËûÃÇ˵һÏ¡£¿ÉÊÇÎÒµÄÄÜÁ¦ÓÐÏÞ¡£ËùÒÔÎÒÒ²²»ºÃ¶Ôij¸öͬѧ¾ßÌåµÄ˵ʲô£¬¿ÉÊÇ£¬½ñÌìÔÚÍøÉÏ¿´µ½Ò»ÕÅͼƬ¡£¸Ð¾õ¶Ô´ó¼ÒÌá³öµÄÕâ¸öÎÊÌâÓиöºÜºÃµÄ½âÊÍ˵Ã÷¡£
       ......

javaģʽ֮µ¥Àýģʽ

javaģʽ֮µ¥Àýģʽ£º
          µ¥Àýģʽȷ±£Ò»¸öÀàÖ»ÓÐÒ»¸öʵÀý£¬×ÔÐÐÌṩÕâ¸öʵÀý²¢ÏòÕû¸öϵͳÌṩÕâ¸öʵÀý¡£
 Ìص㣺
       1£¬Ò»¸öÀàÖ»ÄÜÓÐÒ»¸öʵÀý
       2£¬×Ô¼º´´½¨Õâ¸öʵÀý
  & ......

¸ã¶®javaÖеÄsynchronized¹Ø¼ü×Ö

ʵ¼ÊÉÏ£¬ÎÒ¹ØÓÚjavaµÄ»ù´¡ÖªÊ¶µÄ90%ÒÔÉ϶¼À´×ÔThinking in Java¡£¶ÔÓÚÆäÖеÄsynchronized¹Ø¼ü×Ö£¬µ±Ê±¾ÍÊÇä¯ÀÀһϣ¬´ó¸ÅÖªµÀÒâ˼£¬Ò²Ã»ÓÐϸ¿´¡£ºóÀ´Ò»Ö±Ã»ÓÐÓùýÕâ¸ö¹Ø¼ü×Ö¡£×òÌì¿´Thinking in Patterns with JavaÖеÄObserverģʽ£¬¿´ÁËÆäÖеÄObservableÀàµÄÔ´Â룬·¢ÏÖÀïÃ漸ºõËùÓеķ½·¨¶¼ÓÃÁËsynchronized¹Ø¼ü×Ö£¨²»ÊÇÈ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ