Java Filter¹ýÂËÆ÷ʹÓÃ
±¾ÎÄÀ´×ÔCSDN²©¿Í£¬×ªÔسö´¦£ºhttp://blog.csdn.net/royaki/archive/2009/05/07/4159279.aspx
1¡¢½¨Á¢Ò»¸öServlet²¢ÇÒʵÏÖFilter½Ó¿Ú
¸ÃÀàÐèҪʵÏÖFilter½Ó¿ÚÖеÄinit() doFilter() destory()·½·¨
ÆäÖÐinit()·½·¨×Ô¶¯ÔÚÏîÄ¿Æô¶¯µÄʱºò¼ÓÔØ£¬doFilter()ÔÚµ÷ÓÃxmlÅäÖõÄ·¾¶ÊǼÓÔØ£¬destory()·½·¨ÔÚÍ˳öÏîÄ¿µÄʱºò½øÐС£
public class TestFilter implements Filter{
public void init(FilterConfig filterConfig) throws ServletException{
System.out.println("³õʼ»¯Filter");
}
public void doFilter(ServletRequest request,ServletResponse response,FilterChain chain) throws Exception{
System.out.println("½øÐÐdoFilter");
chain(request,response); //ʹÓÃÕâÒ»¾ä¼ÌÐøServletÇëÇó
}
public void destory(){
System.out.println("¹ýÂËÆ÷Ïú»Ù");
}
}
2¡¢ÔÚxmlÖÐÅäÖÃFilter
<filter>
<filter-name></filter-name>
<filter-class></filter-class>
</filter>
<filter-mapping>
<filter-name></filter-name>
<url-pattern>/*</url-pattern> //ÕâÀïÏë¶ÔÄĸö·¾¶½øÐйýÂ˾ÍÌîдÄĸö
</filter-mapping>
Ó¦Óãº
±àÂë¹ýÂË
public void doFilter(ServletRequest request,ServletResponse response,FilterChain chain) throws Exception{
System.out.println("½øÐÐdoFilter"±àÂë¹ýÂË);
try
{
request.setCharacterEncoding("GB2312") ;
}
catch (Exception e)
{
e.printStackTrace();
}
chain.doFilter(request,response) ;
}
xmlÖеÄÅäÖãº
<url-pattern>/*</url-pattern> ¶ÔËùÓÐÇëÇó¶¼¹ýÂË
Ãô¸Ð´Ê»ã¹ýÂË
public void doFilter(ServletRequest request,
ServletResponse response,
FilterChain chain)
throws IOExce
Ïà¹ØÎĵµ£º
instanceofÊÇJavaµÄÒ»¸ö¶þÔª²Ù×÷·û£¬ºÍ==£¬>£¬<ÊÇͬһÀà¶«¶«¡£ÓÉÓÚËüÊÇÓÉ×Öĸ×é³ÉµÄ£¬ËùÒÔÒ²ÊÇJavaµÄ±£Áô¹Ø¼ü×Ö¡£ËüµÄ×÷ÓÃÊDzâÊÔËü×ó±ßµÄ¶ÔÏóÊÇ·ñÊÇËüÓұߵÄÀàµÄʵÀý£¬·µ»ØbooleanÀàÐ͵ÄÊý¾Ý¡£¾Ù¸öÀý×Ó£º
¡¡¡¡String s = "I AM an Object!";
¡¡¡¡boolean isObject = s instanceof Object;
¡¡¡¡ÎÒÃÇÉùÃ÷ÁËÒ»¸öSt ......
ת×Ô£ºhttp://student.csdn.net/space.php?uid=52781&do=blog&id=15267&cid=50252
javaÖÐʹÓÃÕýÔò±í´ïʽ
¼ÆËã»úרҵ±ÏÒµ»òÕßʹÓùýUnix¡¢PerlµÈ²úÆ·µÄ¶ÁÕßÒ»¶¨¶ÔÕýÔò±í´ïʽÓÐÒ»¶¨µÄÓ¡Ïó,¼´Ê¹Ã»ÓнӴ¥¹ýÕýÔò±í´ïʽҲ²»Òª±»ËüµÄÍâòËùÏŵ¹¡£ËäÈ»×öµ½¾«Í¨ÕýÔò±í´ïʽ±È½ÏÄÑ£¬µ«ÊÇÄܹ»ÕÆÎÕËüµÄ»ù±¾Ó¦ÓÃÈ´ÊÇ· ......
J2ME£¬ÏÖ³ÆÎªJava ME(Java Platform, Micro Edition )ÊÇΪ»ú¶¥ºÐ¡¢Òƶ¯µç»°ºÍPDAÖ®ÀàǶÈëʽÏû·Ñµç×ÓÉ豸ÌṩµÄJavaÓïÑÔÆ½Ì¨£¬°üÀ¨ÐéÄâ»úºÍһϵÁбê×¼»¯µÄJava API¡£ËüºÍJava SE¡¢Java EEÒ»Æð¹¹³ÉJava¼¼ÊõµÄÈý´ó°æ±¾£¬²¢ÇÒͬÑùÊÇͨ¹ýJCP£¨Java Community Process£©Öƶ©µÄ¡£
Ŀǰ½×¶Î£¬Java ME×îÁ÷ÐеÄÓ¦ÓÃÊÇÓÎÏ·Èí¼þ¡£ÒòÎ ......
xmlµÄÓ¦ÓÃÔ½À´Ô½¹ã·º£¬³ÃÎÞÊÂʱ£¬ÕÒÁËһƪÎÄÕÂת¹ýÀ´£¬ÒÔ±¸ÒÔºóѧϰ¡£ÒÔÏÂÊÇÎÄÕÂÄÚÈÝ¡£
1. ½éÉÜ
1£©DOM£¨JAXP Crimson½âÎöÆ÷£©
DOMÊÇÓÃÓëÆ½Ì¨ºÍÓïÑÔÎ޹صķ½Ê½±íʾXMLÎĵµµÄ¹Ù·½W3C±ê×¼¡£DOMÊÇÒÔ²ã´Î½á¹¹×éÖ¯µÄ½Úµã»òÐÅϢƬ¶ÏµÄ¼¯ºÏ¡£Õâ¸ö²ã´Î½á¹¹ÔÊÐí¿ª·¢ÈËÔ±ÔÚÊ÷ÖÐѰÕÒÌØ ......
1 Boolean VS boolean
public final class Booleanextends [url=file:///G:/html_zh_CN/html/zh_CN/api/java/lang/Object.html]Object[/url]implements [url=file:///G:/html_zh_CN/html/zh_CN/api/java/io/Serializable.html]Serializable[/url], [url=file:///G:/html_zh_CN/html/zh_CN/api/java/lang ......