´«ÖDz¥¿ÍJavaÅàѵ JSPÄÚÖöÔÏó¡¢Òì³£´¦ÀíÓëÂÒÂëÎÊÌâ
JSP¾Å´óÄÚÖöÔÏó£º
1.ÓëServletÓйصÄÒþº¬µÄ¶ÔÏó
(1)page page¶ÔÏó¶ÔÓ¦JavaÖеĹؼü×Öthis,Ëü´ú±íµ±Ç°JSPÒ³Ãæ
(2)config Config¶ÔÏóʹÓÃWebÈÝÆ÷ÔÚ³õʼ»¯JSP֮ǰµÃµ½JSPÅäÖÃÐÅÏ¢£¬configµÄ×÷ÓÃÓòΪÕû¸öÒ³Ã棬Ó÷¨¸úservletConfigÏàͬ
2.ÓëInput/OutputÓйصÄÒþº¬¶ÔÏó
(3)out out¶ÔÏó½«ÏìÓ¦µÄÐÅÏ¢Êä³öµ½ÍøÒ³ÉÏ£¬Æ仺³å´óСͨ¹ýpageÖ¸Áî±êÇ©µÄbufferÊôÐÔÉèÖÃ
(4)request ·â×°ÁËä¯ÀÀÆ÷·¢³öµÄÇëÇó¶ÔÏó£¬ËüµÄ×÷ÓÃÓòÊÇÒ»¸öÍêÕûµÄÇëÇó£¬Õ⽫×÷Ϊ_jspServiceµÄÈë¿Ú²ÎÊý
(5)response ·â×°ÏìÓ¦ÄÚÈݵĶÔÏó£¬×÷ÓÃÓòÊÇÕû¸öÒ³Ãæ³£Ó÷½·¨:response.setHeader("refresh","1;url="Ò³ÃæÃû³Æ""); response.sendRedirect("Ò³ÃæÃû³Æ")Öض¨Ïò
3.JSPÖ´ÐÐʱ£¬ÌṩÓйØContextµÄÒþº¬¶ÔÏó
(6)session ¿Í»§¶Ë·¢ËÍÒ»¸öÇëÇóʱ£¬ÔÚ·þÎñÆ÷ÉϽ«´´½¨Ò»¸ö»á»°Î¬»¤Õâ¸ö¿Í»§µÄ¸÷ÖÖ²Ù×÷£¬¸Ã¶ÔÏó³ÆΪsession,Ö»ÒªÖ¸Áî±êÇ©ÖÐûÓн«»á»°È¡Ïû(<%@ page session=”false”%>,¾Í¿ÉÒÔʹÓøöÔÏó£¬Í¨¹ýsession¶ÔÏóµÄsetAttributeºÍgetAttribute·½·¨¿Éά»¤sessionÖеĶÔÏó¡£µ±session=falseʱ£¬¿ÉÒÔÓÃrequest.getSession()·½·¨»ñÈ¡session
(7)application ËüÌṩÁËÒ»×éºÍWebÈÝÆ÷ͨÐŵķ½·¨£¬Ã¿¸öÓ¦ÓóÌÐò¶¼ÓÐÒ»¸öÉÏÏÂÎÄ£¬ÕâÒâζ×ÅApplication¶ÔÏóÄܹ»ÔÚÓ¦ÓóÌÐòµÄÕû¸öÉúÃüÖÜÆÚ·ÃÎÊ¡£ÓëservletµÄservletContext¶ÔÏóÓ÷¨Ïàͬ
(8)pageContext pageContext¶ÔÏó·â×°Á˵±Ç°JSPÒ³ÃæµÄÔËÐÐÐÅÏ¢£¬ËüÌṩÁË·µ»ØJSPÒ³ÃæµÄÆäËûÒþʽ¶ÔÏóµÄ·½·¨¡£ PageContextÀàÖж¨ÒåÁËÒ»¸ösetAttribute·½·¨À´½«¶ÔÏó´æ´¢½øpageContext¶ÔÏóÄÚ²¿µÄÒ»¸öHashMap¶ÔÏóÖУ¬Í¬Ê±Ò²¶¨ÒåÁËÒ»¸ögetAttribute·½·¨À´¼ìË÷´æ´¢ÔÚ¸ÃHashMap¶ÔÏóÖеĶÔÏó¡£PageContextÀà³ýÁË¿ÉÒÔ´æ´¢ºÍ¼ìË÷×ÔÉíÖеÄÊôÐÔ¶ÔÏóÍ⣬»¹¶¨ÒåÁË¿ÉÒÔ´æ´¢ºÍ¼ìË÷ÆäËûÓò·¶Î§ÄÚµÄÊôÐÔ¶ÔÏóµÄ·½·¨¡£
4.ÓëErrorÓйضÔÏóµÄÒþº¬¶ÔÏó
(9)exception ÊÇjava.lang.ThrowableµÄÒ»¸öʵÀý£¬Ëü´ú±íδÆË»ñµÄÒì³££¬Ö»ÓÐÔÚpageÖ¸ÁîÖÐÖ¸¶
Ïà¹ØÎĵµ£º
http://babyjoycry.javaeye.com/blog/587527
1. import info.monitorenter.cpdetector.io.CodepageDetectorProxy;
2. import info.monitorenter.cpdetector.io.HTMLCodepageDetector;
3. import info.monitorenter.cpdetector.io.JChardetFacade;
4.
5. import java.io.BufferedReader;
......
¹«Ë¾Vac·½·¨¹ýÂËÆ÷ʹÓõ½·´Éä»úÖÆ£¬¶ÁÈ¡xmlÅäÖÃÎļþ¹ýÂËÓû§·ÃÎʵķ½·¨ÃûÊÇ·ñºÏ·¨¡£
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
HttpServletRequest httpRequest = (HttpServletRe ......
1 . 1 2 . 1 ²»ÒªÃÔʧ
ÔÚÕû¸ö¿ª·¢¹ý³ÌÖУ¬×îÖØÒªµÄÊÂÇé¾ÍÊÇ£º²»Òª½«×Ô¼ºÃÔʧ£¡µ«ÊÂʵÉÏÕâÖÖÊÂÇéºÜÈÝÒ×·¢Éú¡£´ó¶àÊý·½·¨¶¼Éè
¼ÆÓÃÀ´½â¾ö×î´ó·¶Î§ÄÚµÄÎÊÌâ¡£µ±È»£¬Ò²´æÔÚһЩÌرðÀ§ÄѵÄÏîÄ¿£¬ÐèÒª×÷Õ߸¶³ö¸üΪ¼èÐÁµÄŬÁ¦£¬»òÕ߸¶
³ö¸ü´óµÄ´ú¼Û¡£µ«ÊÇ£¬´ó¶àÊýÏîÄ¿¶¼ÊDZȽϓ³£¹æ”µÄ£¬ËùÒÔÒ»°ã¶¼ÄÜ×÷³ö³É¹¦µÄ·ÖÎö ......
ÏÂÃæµÄ³ÌÐòʹÓÃÁ˸´ºÏµÄÒì»ò¸³Öµ²Ù×÷·û£¬ËüËùչʾµÄ¼¼ÊõÊÇÒ»ÖÖ±à³ÌÏ°Ëס£ÄÇôËü»á´òÓ¡³öʲôÄØ£¿
public class CleverSwap{
public static void main(String[] args){
int x = 1984; // (0x7c0)
int y = 2001; // (0x7d1)
x^= y^= x^= y;
System.out.println("x= " + x + "; y= " + y);
}
}
¾ÍÏñÆäÃû³Æ ......