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

Java Web µÚÎåÌì Web״̬¹ÜÀí

Ò»¡¢
ΪʲôҪ
Web
״̬¹ÜÀí
¶ÔÓÚÿ¸öÈÝÆ÷¶øÑÔÿ¸öÇëÇó¶¼Ï൱ÓÚÒ»¸öеĿͻ§£¬ÒòΪµ±·þÎñÆ÷Éú³É
Response
·µ»Øµ½¿Í»§¶Ë£¬ÔÚ¿Í»§¶ËÏÔʾ³öÀ´ºóÏà¶ÔÓ¦µÄ
Socket
¾Í»á¹Ø±Õ£¬ËùÒÔ
HTTP
ЭÒéÊǸöÎÞ״̬µÄЭÒ飬Ëû²»Äܱ£´æµ±Ç°Óû§µÄÐÅÏ¢¡£
¶þ¡¢
ʵÏÖ״̬¹ÜÀíµÄ·½Ê½
1.      

ÔÚÍøÒ³ÖÐ±íµ¥ÖÐÌí¼ÓÒþ²Ø×Ö¶Î
ȱµã£ºÐèҪÿ´ÎÔÚ
Servlet
Öж¯Ì¬Éú³ÉÕâÖÖÒþ²Ø×ֶΡ£
2.      

ÀûÓÃ
Cookie
ȱµã£ºËùÓеÄÐÅÏ¢¶¼±£´æÔÚ¿Í»§¶Ë£¬²»°²È«¡£ä¯ÀÀÆ÷¹Ø±Õºó´ú±í×ŵ±Ç°
cookie
¾Í¹ýÆÚÁË¡£
3.      

ÀûÓÃ
Session
Óŵ㣺ÔÚ¿Í»§¶Ë
cookie
ÖÐÖ»±£´æһЩ²»ÖØÒªµÄÐÅÏ¢£¬±ÈÈç
SessionID
µÈÄÚÈÝ£¬ÖØÒªÐÅÏ¢±£´æÔÚ·þÎñÆ÷¶Ë£¬ÕâÑù°²È«¡£¶øÇÒµ±¿Í»§¶Ë½ûÓÃÁË
cookie
ºóÄܹ»ÀûÓÃ
URL
ÖØдʵÏÖ¡£µ±¿Í»§¶Ë¹Ø±Õºó·þÎñÆ÷¶ËµÄ
Session
²»»áÏú»Ù¡£
Èý¡¢
Cookie
Cookie coo = new
Cookie(“xzw”,” 2005”);
response.addCookie(coo);
coo.getMaxAge(5);
ËÄ¡¢
Session
ͨ¹ý
request.getSession()
´´½¨
Session
¶ÔÏó£¬Í¨¹ý
invalidate()
ʹ
Session
ʧЧ¡£
Îå¡¢
URL
ÖØд
Web
·þÎñÆ÷»á×Ô¶¯µ÷ÓÃ
Cookie
ºÍ
URL
ÖØд£¬µ±¿Í»§¶Ë½ûÓÃ
cookie
ºó»á×Ô¶¯µ÷ÓÃ
URL
ÖØд¡£
      

String str = response.encodeURL(“url”);
      

response.sendRirect(str);


Ïà¹ØÎĵµ£º

javaËø»úÖÆSynchronized


Ô­ÎÄÒý×Ôhttp://hi.baidu.com/heyinjie/blog/item/608ee7108f1f4802203f2e35.html
´ò¸ö±È·½£ºÒ»¸öobject¾ÍÏñÒ»¸ö´ó·¿×Ó£¬´óÃÅÓÀÔ¶´ò¿ª¡£·¿×ÓÀïÓкܶ෿¼ä£¨Ò²¾ÍÊÇ·½·¨£©¡£ÕâЩ·¿¼äÓÐÉÏËøµÄ£¨synchronized·½·¨£©£¬ ºÍ²»ÉÏËøÖ®·Ö£¨ÆÕͨ·½·¨£©¡£·¿ÃÅ¿Ú·Å×ÅÒ»°ÑÔ¿³×£¨key£©£¬Õâ°ÑÔ¿³×¿ÉÒÔ´ò¿ªËùÓÐÉÏËøµÄ·¿¼ä¡£ÁíÍâÎÒ°ÑËùÓÐÏë ......

JAVAѧϰµÄÊý¾Ý¿âÁ¬½Ó£¬Àý×ÓÒ»Ö»¡­¡­

³õѧJAVA£¬ºÃ²»ÈÝÒ×½â¾öÁËÕâ¸öÊý¾Ý¿âÁ¬½ÓÎÊÌ⣬Õâ¸öÖ÷ÒªÊÇÓÐÁ½¸öÎÊÌ⣬һ¸öÊÇJDBC-odbcµÄÎÊÌ⣬Èç¹ûûÓнâ¾öºÃÊý¾ÝÔ´ÅäÖ㬾ø¶ÔÊÇÓÐÈÝÒ׳öÎÊÌâµÄ£¬¼ÙÉèÄãʹÓõÄÊÇaccessµÄÊý¾Ý¿â£¬ÕâÊÇÍøÉϵÄÒ»¸öÀý×ÓµÄÓï¾ä
String dburl="jdbc:odbc:driver={Microsoft Access Driver (*.mdb)};DBQ=database.mdb";
Æäʵ²¢²»ÐèÒªÄÇô³¤£¬¼Ù ......

Java Web µÚ9Ìì jsp

Ò»¡¢
ΪʲôҪʹÓÃ
JSP
ÔÚ¿Í»§¶ËÍøÒ³±à³ÌÖÐ
Java
µÄ½â¾ö·½°¸ÊÇ
Servlet/JSP
¡£¶ÔÓÚ¶¯Ì¬Ò³ÃæµÄÐγÉÎÒÃÇ¿ÉÒÔÀûÓÃÔÚ
Servlet
Öбàд×Ö·û´®ÊµÏÖ£¬µ«ÊÇÕâÑù»áʹ³ÌÐòÔ±µÄ¹¤×÷±äµÃÒì³£µÄ·±Ëö£¬ËùÒÔÎÒÃDzÉÓÃ
JSP
´ïµ½ÍøÒ³µÄ¶¯Ì¬ÏÔʾ¡£
¶þ¡¢
ʲôÊÇ
JSP
JSP
£¨
JavaServerPage
£©ºÍ
Servlet
ÊÇ
Java
ÖвúÉú¶¯Ì ......

Java Web µÚ9Ìì jsp 2

5.      

JSP
±ê×¼¶¯×÷¡¢
JSP
Ö¸ÁîÓÃÓÚÒ³ÃæÓëÈÝÆ÷¼äµÄͨÐÅ£¬¶ø
JSP
±ê×¼¶¯×÷ÓÃÓÚÒ³ÃæÓëÒ³Ãæ»òÕßÒ³ÃæÓë×é¼þ¼äµÄͨÐÅ¡£È磺
<jsp:include
page=”localURL” flush=”true”>
 
6.      

JSP
Òþʽ¶ÔÏó
ÔÚ
......

Java Web µÚËÄÌì ʹÓÃServlet´¦ÀíÇëÇó

Ò»¡¢
GET
ºÍ
POST
µÄÇø±ð
1.GET
Ìá½»µÄÊÇÎı¾ÄÚÈÝ£¬¹æ¶¨ÆäÊý¾Ý³¤¶È²»³¬¹ý
255
¸ö×Ö·û¡£ÔÚ
GET
·½Ê½Ìá½»µÄ
URL
ÖлáÏÔʾ³öÌá½»µÄ²éѯÊý¾Ý¶øÈ´Ìá½»Êý¾ÝµÄ»º´æ»áÔÚä¯ÀÀÆ÷µÄ
URL
Àúʷ״̬ÖУ¬ÕâÑùÎÒÃÇÍùÍùÔÚä¯ÀÀÍøÒ³µÄʱºòµã»÷ºóÍ˼ü²»ÐèÒªÖØз¢ËÍÇëÇó¡£
2.POST
Ìá½»µÄ¿ÉÒÔʹÎı¾ÄÚÈÝ£¬Ò²¿ÉÒÔʹ¶þ½øÖÆÄÚÈÝ£¬Ëù ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ