JSPÈçºÎÉèÖÃCookieºÍɾ³ýCookie
ºÜ¶àÀýÈçµÇ¼»òÕß×¢ÏúµÇ¼µÄµØ·½ÐèҪʹÓõ½Cookie£¬½ñÌìѧµ½ÔÚJSPÖÐÈçºÎ²Ù×÷Cookie·ÖÏíÏÂ
4.CookieÀà³£Óõķ½·¨
1.setValue()/getValue() —>»ñÈ¡cookie¶ÔÏóµÄÖµ¡£
2.getName()—>»ñÈ¡cookie¶ÔÏóµÄÃû³Æ£¬Ñ»·µÄʱºò¿ÉÒÔÓÐÑ¡ÔñµÄʹÓÃCookie
3.setMaxAge()/getMaxAge()—>ÉèÖûò»ñÈ¡cookie¶ÔÏóÓÐЧʱ¼ä£¬Èç¹û²»ÉèÖÃÔòĬÈϸÃcookie»áÔÚµ±Ç°»á»°½áÊøºóʧЧ£¬ÉèÖõϰ²ÎÊýµÄµ¥Î»ÎªÃÈçsetMaxAge(60)ΪÓÐЧÆÚΪ1·ÖÖÓ
4.getComment()/setConmment() —>ΪcookieÉèÖûò¶ÁȡעÊÍ
5.getDomain()/setDomain() —>ÉèÖûò»ñÈ¡cookieµÄÊÊÓÃÓò£¨Ð¡¿ÉÒ²²»Ì«Ã÷°×,Íû¸ßÈËÖ¸½Ì£©
............
2.¶ÁÈ¡Cookie
Cookie cookies[] = request.getCookies();
×¢Òâ»òµÃµ½µÄÊÇËùÓÐCookieµÄÊý×é¶ÔÏó£¬ÐèҪѻ·±éÀúʹÓÃ
for(int i=0;i<cookies.length;i++)
System.out.println(cookies[i].getValue());
3.ɾ³ýCookie
for(int i=0;i<cookies.length;i++){
cookies[i].setMaxAge(0);
response.addCookie(cookies[i])}
¼´¿É
1.ÉèÖÃCookie
Cookie cookie = new Cookie("cookieName","cookieValue");
ÆäÖÐcookieNameΪCookie¶ÔÏóµÄÃû³Æ,δÀ´»ñÈ¡CookieµÄʱºòÐèҪʹÓá£cookieValueΪCookie¶ÔÏóµÄÖµÒ²¾ÍÊÇ´¢´æÓû§µÄÐÅÏ¢ÈçÓû§Ãû¡¢ ÃÜÂëµÈ¡£
Õâ²½Íê³ÉÁËÖ»ÊÇʵÀý»¯Á˶ÔÏó£¬Ö®ºóÐèÒªÓõ½response.addCookie();½«cookie¼ÓÈëµ½HTTPÍ·ÖÐ
Ïà¹ØÎĵµ£º
PO £ºpersistent object³Ö¾Ã¶ÔÏó
1 £®ÓÐʱҲ±»³ÆÎªData¶ÔÏ󣬶ÔÓ¦Êý¾Ý¿âÖеÄentity£¬¿ÉÒÔ¼òµ¥ÈÏΪһ¸öPO¶ÔÓ¦Êý¾Ý¿âÖеÄÒ»Ìõ¼Ç¼¡£
2 £®ÔÚhibernate³Ö¾Ã»¯¿ò¼ÜÖÐÓëinsert/delet²Ù×÷ÃÜÇÐÏà¹Ø¡£
3 £®POÖв»Ó¦¸Ã°üº¬ÈκζÔÊý¾Ý¿âµÄ²Ù×÷¡£
---------------------------------------------------------
POJO £ºpla ......
JFreeChartÊÇÒ»×鹦ÄÜÇ¿´ó¡¢Áé»îÒ×ÓõÄJava»æÍ¼API£¬Ê¹ÓÃËü¿ÉÒÔÉú³É¶àÖÖͨÓÃÐԵı¨±í£¬°üÀ¨Öù״ͼ¡¢±ýͼ¡¢ÇúÏßͼ¡¢¸ÊÌØÍ¼µÈ¡£ËüÄܹ»ÓÃÔÚSwingºÍWebµÈÖÐÖÆ×÷×Ô¶¨ÒåµÄͼ±í»ò±¨±í£¬²¢Çҵõ½¹ã·ºµÄÓ¦Óᣱ¾ÎĽ«Í¨¹ýÒýÁì¶ÁÕßѧϰÔÚJFreeChartÖбýͼ¡¢Öù״ͼºÍÇúÏßͼµÄ½ø½×Ó¦Óã¬À´´ïµ½ÊìÁ·Ê¹ÓÃJFreeChartµÄÄ¿µÄ¡£
Ò»£® &nb ......
ÎÒÃǶ¼ÖªµÀÔÚjspÖÐincludeÓÐÁ½ÖÖÐÎʽ,·Ö±ðÊÇ
< %@ include file=” ”%>
< jsp:include page=” ” flush=”true”/>
¡¡¡¡Ç°ÕßÊÇÖ¸ÁîÔªËØ¡¢ºóÕßÊÇÐÐÎªÔªËØ¡£¾ßÌåËüÃǽ«Ôںδ¦Óã¿ÈçºÎÓü°ËüÃÇÓÐÊ²Ã´Çø±ð£¿ÕâÓ¦¸ÃÊǺܶàÈË¿´µ½Ëü¶¼»áÏëµ½µÄÎÊÌâ¡£ÏÂÃæÒ»ÆðÀ´¿´¿´°É¡£
¡ ......
JDK 1.5 +ECLIPSE +TOMCAT 5.0.28 + MYSQL 5.0
Êý¾Ý¿âTEST¡¡£¬±íÃûnews
×ֶΣº¡¡id int ×Ô¶¯Ôö³¤¡¡, Title varchar(20) , Content varchar(200) , Author varchar(10)
makeFile.jsp
<%
Connection conn = DBconn.getConnection();
......
Ò»¡¢»ù±¾¸ÅÄ 1.±êÇ©(Tag): ±êÇ©ÊÇÒ»ÖÖXMLÔªËØ£¬Í¨¹ý±êÇ©¿ÉÒÔʹJSPÍøÒ³±äµÃ¼ò½à²¢ÇÒÒ×ÓÚά»¤£¬»¹¿ÉÒÔ·½±ãµØÊµÏÖͬһ¸öJSPÎļþÖ§³Ö¶àÖÖÓïÑÔ°æ±¾¡£ÓÉÓÚ±êÇ©ÊÇXMLÔªËØ£¬ËùÒÔËüµÄÃû³ÆºÍÊôÐÔ¶¼ÊÇ´óСдÃô¸ÐµÄ 2.±êÇ©¿â(Tag library): ÓÉһϵÁй¦ÄÜÏàËÆ¡¢Âß¼ÉÏ»¥ÏàÁªÏµµÄ±êÇ©¹¹³ÉµÄ¼¯ºÏ³ÆÎª±êÇ©¿â¡£ 3.±êÇ©¿âÃèÊöÎļþ(Tag Libr ......