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

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Í·ÖÐ


Ïà¹ØÎĵµ£º

ÓÃJFreeChartÔöÇ¿JSP±¨±íµÄÓû§ÌåÑé(3)

ËÄ£®ÇúÏßͼ
½Ó×ÅÎÒÃÇÀ´½éÉÜÇúÏßͼµÄʹÓá£ÔÚ±ÊÕßÈÕ³£µÄ¿ª·¢¹¤×÷ÖУ¬ÇúÏßͼÓõÃ×î¶à£¬Ëü¿ÉÒÔÓÃÀ´»æÖÆÇ÷ÊÆͼ¡¢Í³¼Æ·ÖÎöµÈ¡£Ê×ÏÈÎÒÃÇÔÚWebRootϽ¨Á¢Ò»¸ölineĿ¼£¬ÓÃÀ´´æ·ÅÇúÏßͼʵÀýµÄjspÒ³Ãæ¡£ÎÒÃÇÔÚ¸ÃĿ¼Ï½¨Á¢sample1.jspÒ³ÃæÀ´×öÒ»¸ö¼òµ¥µÄÇúÏßͼµÄÀý×Ó¡£ÔÚ¿ªÊ¼±àÂëÇ°£¬ÈÃÎÒÃÇÀ´¿´¿´Óë»­ÇúÏßͼÃÜÇÐÏà¹ØµÄ¼¸¸öÀࣺ
1£© ......

JSPÖÐincludeÖ¸ÁîºÍincludeÐÐΪµÄÇø±ð

 
ÎÒÃǶ¼ÖªµÀÔÚjspÖÐincludeÓÐÁ½ÖÖÐÎʽ,·Ö±ðÊÇ
< %@ include file=” ”%>
< jsp:include page=” ” flush=”true”/>
¡¡¡¡Ç°ÕßÊÇÖ¸ÁîÔªËØ¡¢ºóÕßÊÇÐÐΪԪËØ¡£¾ßÌåËüÃǽ«Ôںδ¦Óã¿ÈçºÎÓü°ËüÃÇÓÐʲôÇø±ð£¿ÕâÓ¦¸ÃÊǺܶàÈË¿´µ½Ëü¶¼»áÏëµ½µÄÎÊÌâ¡£ÏÂÃæÒ»ÆðÀ´¿´¿´°É¡£
¡ ......

JSP¹îÒì´íÎó

   ±¾µØÓõÄÊÇtomcat6£¬ÔËÐÐÒ»Çж¼Õý³£¡£°Ñϵͳ²¿µ½Ô¶³ÌÉÏʱºò±¨Õâ¸ö´íÎ󣺠   Syntax error on token "<", invalid AssignmentOperator
Syntax error on token "<", invalid AssignmentOperator
ÔÚÍøÉÏÕÒµ½Ô­Òò£º
Õâ¸ö´íÎó¿ÉÄÜÊÇÒòΪÄãÔÚjspÖÐÓõ½ÁË·ºÐÍ¡£
°Ñ·ºÐÍÈ¥µôÊÔÊÔ¾Í ......

ÕýÔò±í´ïʽÔËÓõ½JSPÒ³Ãæ

ÓÃÕýÔò±í´ïʽÏÞÖÆÖ»ÄÜÊäÈëÖÐÎÄ£ºonkeyup="value=value.replace(/[^\u4E00-\u9FA5]/g,'')" onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\u4E00-\u9FA5]/g,''))"
ÓÃÕýÔò±í´ïʽÏÞÖÆÖ»ÄÜÊäÈëÈ«½Ç×Ö·û£º onkeyup="value=value.replace(/[^\uFF00-\uFFFF]/g,'')" onbeforepaste="cl ......

JSP¡¢ServletÖеÄÏà¶Ô·¾¶ºÍ¾ø¶Ô·¾¶£¨×ªÔØ£©

 JSPºÍServletÖеľø¶Ô·¾¶ºÍÏà¶Ô·¾¶ÎÊÌâÀ§ÈÅÁËÎҺü¸Ì죬¾­¹ýŬÁ¦Ö®ºó½«Æ䲿·ÖÐĵúʹó¼Ò¹²Ïí¡£
Ç°Ì᣺¼ÙÉèÄãµÄHttpµØַΪhttp://192.168.0.1/ÄãµÄwebÓ¦ÓÃΪwebapp£¬ÄÇôÄãµÄwebÓ¦ÓÃURLΪhttp://192.168.0.1/webapp/
webÓ¦ÓõÄĿ¼½á¹¹£º
webapp/
    
web-inf/
     ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ