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

jspÖ®session

     session¾ÍÊÇÒ»¸öÈ«¾Ö±äÁ¿£¬ÊÇä¯ÀÀÆ÷Ïß³ÌÔÚ·þÎñÆ÷¶ËµÄ´úÀí¡£web·þÎñ³ÌÐòÖ»Òª´ò¿ª£¬session¾Í»á´æÔÚ£¬µ±ÄãµÚÒ»´Î·ÃÎÊʱ£¬session»á×Ô¶¯ÎªÄã·ÖÅäÒ»¸ösession ID£¬ËùÒÔsessionΪн¨Á¢µÄ£¬ËùÒÔsession.isNew()Ϊtrue¡£µ±ÄãË¢ÐÂÒ³ÃæÊ±£¬Õâ¸ösession IDÒ»Ö±´æÔÚ(session.getId()²»±ä)£¬²»»áÏûʧ£¬ËùÒÔsession.isNew()Ϊfalse¡£³ý·ÇÄã¹Ø±ÕÄãÒª·ÃÎʵÄwebÕ¾µã£¬»òÔò¹Ø±Õsession(session.invalidate())£¬Õâ¸ösession ID²Å»áÏûʧ(session.getId()±äÁË),isNew()Ϊtrue¡£
Á½¸ö·½·¨ session.isNew() ÅжÏÊÇ·ñÊÇÒ»¸öÐÂsession
               session.getId() µÃµ½Õâ¸ösession id
µ±¹Ø±ÕËùÓеÄä¯ÀÀÆ÷£¬ÔÙÖØÐµÇ¼µÄʱºòsession.isNew()²Å»áÊÇtrue
µ±Ã¿´Î¶¼Ð´ò¿ªÒ»¸öä¯ÀÀÆ÷Óò»Í¬µÄÓû§µÇ¼£¬session.isNew() ÊÇΪfalse¡£session.getId()ÊDz»±äµÄ,¡£
¼´£ºsession idÏ൱ÊÇ´ò¿ªÒ»¸öä¯ÀÀÆ÷½ø³Ì(²»ÊÇÏß³Ì)ʱweb·þÎñÆ÷Ϊ±¾ä¯ÀÀÆ÷½ø³Ì·ÖÅäµÄid
³£Ó÷½·¨£º
  long create_time = session.getCreationTime();    //session´´½¨Ê±¼ä
  long access_time = session.getLastAccessedTime();//session×îºó·ÃÎÊʱ¼ä
 //´òÓ¡sessionÀïÃæµÄattributeÖµ
  Enumeration elements = session.getAttributeNames();
  while (elements.hasMoreElements()) {
       String id = (String)elements.nextElement();
   }
response.setHeader("Refresh","5;url=/session_filter_listener/index.jsp");//ÿ5ÃëÖÓˢУ¬È»ºó¶¨Î»µ½index.jsp


Ïà¹ØÎĵµ£º

JSPÒ³Ãæµ÷ÓÃjsÖÐÎÄÂÒÂë

jspÖеÚÒ»¾ä£º
<%@ page language="java" import="java.sql.*,java.util.*,"  contentType="text/HTML;charset=gb2312" pageEncoding="gb2312"%>
htmlÖмÓÉÏ
<meta http-equiv="Content-Type" content="text/html;charset=gb2312" />
ͨ³£ÕâÑù¾ÍûÓÐÎÊÌâÁË¡£    .
ÔÙÕߣº µ¼ÈëjsʱºòÉ ......

ÎÒ¿ª·¢Ò»¸öjspϵͳʱÅöµ½µÄÎÊÌâ

1.No getter method for property name problem(struts)
ÓÐÒ»ÖÖ¿ÉÄÜÊÇBeanûÓÐдÏàÓ¦µÄget·½·¨£¬ÀýÈç±äÁ¿userNameµÄget·½·¨ÊÇgetUserName£»
»¹ÓоÍÊÇÕâ¸öBeanΪ¿Õ£»
2.
MyEclipseµÄ×Ô¶¯Ìí¼ÓstrutsºÍhibernate¹¦Äܲ»ÄÜ·µ»Ø£¬Çë×¢Ò⣡
ËùÒÔÎÒÏÈʹÓÃMyEclipseµ¼ÈëstrutsºÍhibernate£¬È»ºó½«ËüÃǵÄjarµ¼Èëµ½ÁíÍâÒ»¸öн¨µÄ ......

·ÃÎÊJSPÎļþ»òÕßServletÎļþʱÌáʾ¡°ÏÂÔØ¡±

ÔÚ·ÃÎÊJSPÎļþ»òÕßServletµÄʱºò£¬Èç¹ûÌáʾÏÂÔØ²¢±£´æ£¬ÈçÏÂͼËùʾ£º
ͬÑùµÄ³ÌÐòÓеÄä¯ÀÀÆ÷³ö´í£¬ÓеÄä¯ÀÀÆ÷²»³ö´í¡£´íÎóµÄÔ­ÒòÊÇÉèÖÃMIMEÀàÐ͵ĴúÂëÓÐÎó¡£
Èç¹ûÊÇJSPÎļþ£¬²é¿´ÎļþÍ·£º
<%@ page contentType="text/html;charset=gb2312"%>
Èç¹ûÊÇServletÎļþ£¬²é¿´£º
response.setContentType("text/html;char ......

JSP,servletµÄÏà¶Ô·¾¶ÎÊÌâ

ǰÌ᣺¼ÙÉèÄãµÄ Http µØÖ·Îª http://192.168.0.1/ ÄãµÄ web Ó¦ÓÃΪ webapp £¬ÄÇôÄãµÄ web Ó¦Óà URL Ϊ http://192.168.0.1/webapp/
[ÎÊÌâ1]
[ÃèÊö]µ±ÔÚ jsp ÖÐÒýÈë css ʱ£¬Èç¹ûÆäÏà¶Ô·¾¶Ïà¶ÔÓÚµ±Ç° jsp ÎļþµÄ£¬¶øÔÚÒ»¸öºÍÕâ¸ö jsp µÄ·¾¶²»Ò»ÑùµÄ servlet ÖÐ forwarder Õâ¸ö jsp ʱ£¬¾Í»á·¢ÏÖÕâ¸ö css Ñùʽ¸ù±¾Ã»ÓÐÆ ......

jspÖеÄÖÐÎIJÎÊýµÄ´«µÝ

ÔÚÏîÄ¿ÖУ¬ÎÒÃǾ­³£Óöµ½ÐèÒªÔÚjspÒ³ÃæÇл»Öд«µÝÖÐÎÄ×Ö·û¡£ÕâÖ÷ÒªÓÐÁ½ÖÖ·½Ê½¡£
¡¡¡¡URL·½Ê½£¬ÀýÈ磺http://website/test1.jsp?act=add&type=Æ»¹û&param=%20D%20B
¡¡¡¡FORM·½Ê½£¬ÀýÈ磺
¡¡¡¡<form name=test mehtod="post">
¡¡¡¡<input type=hidden name=text2 value="ÖÐÎÄ">
¡¡¡¡<input type=t ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ