JSP´¦ÀísessionÓëcookieÑо¿Èý
¶¨ÒåÒ»¸ösession±äÁ¿
session.setAttribute("user_name","joan");
¶ÁÈ¡Ò»¸ösessionµÄÖµ:
String your_name=session.getAttribute("user_name");
ÅжÏÒ»¸ösessionÊÇ·ñ´æÔÚÓ¦ÓÃ:
if((String)session.getAttribute("user_id")==null)
{
out.print("yes");
}
else
{
out.print("no");
}
дÈëÒ»¸öcookieµÄ·½·¨(ÒªÓÃÈý¸öÓï¾ä):
Cookie thecookie=new Cookie("user_name",user_name);
thecookie.setMaxAge(60*60*24*365);
response.addCookie(thecookie);
¶ÁÈ¡Ò»¸öcookieµÄÖµ(JSPÕâ¸ö¹¦ÄÜÓеãÂé·³)
Cookie[] cookies = request.getCookies();
for (int i = 0; i < cookies.length; i++) {
Cookie c = cookies[i];
if(c.getName().equals("user_id"))
{
String aa=c.getValue();
out.print(aa);
}
}
Httpsession¾ßÓÐÈçÏÂAPI:
¡¡¡¡getId¡¡´Ë·½·¨·µ»ØΨһµÄ±êʶ£¬ÕâЩ±êʶΪÿ¸ösession¶ø²úÉú¡£µ±Ö»ÓÐÒ»¸öµ¥Ò»µÄÖµÓëÒ»¸ösessionÁªºÏʱ£¬»òµ±ÈÕÖ¾ÐÅÏ¢ÓëÏÈÇ°µÄsessionsÓйØʱ£¬Ëü±»µ±×÷¼üÃûÓá£
¡¡¡¡GetCreationTime¡¡·µ»Øsession±»´´½¨µÄʱ¼ä¡£×îСµ¥Î»ÎªÇ§·ÖÖ®Ò»Ã롣ΪµÃµ½Ò»¸ö¶Ô´òÓ¡Êä³öºÜÓÐÓõÄÖµ£¬¿É½«´ËÖµ´«¸øDate constructor »òÕßGregorianCalendarµÄ·½·¨setTimeInMillis¡£
¡¡¡¡GetLastAccessedTime¡¡·µ»Øsession×îºó±»¿Í»§·¢Ë͵Äʱ¼ä¡£×îСµ¥Î»ÎªÇ§·ÖÖ®Ò»Ãë¡£
¡¡¡¡GetMaxInactiveInterval¡¡·µ»Ø×Üʱ¼ä£¨Ã룩,¸ºÖµ±íʾsessionÓÀÔ¶²»»á³¬Ê±¡£
¡¡¡¡getAttribute¡¡È¡Ò»¸ösessionÏàÁªÏµµÄÐÅÏ¢¡££¨ÔÚjsp1.0ÖÐΪ getValue£©
¡¡¡¡Integer item = (Integer) session.getAttrobute("item")¡¡//¼ìË÷³ösessionµÄÖµ²¢×ª»¯ÎªÕûÐÍ
¡¡¡¡setAttribute¡¡Ìṩһ¸ö¹Ø¼ü´ÊºÍÒ»¸öÖµ¡£»áÌæ»»µôÈκÎÒÔÇ°µÄÖµ¡£(ÔÚjsp1.0ÖÐΪputValue)
¡¡¡¡session.setAttribute("ItemValue", itemName);¡¡// ItemValue ±ØÐë²»ÊÇmust¼òµ¥ÀàÐÍ
5¡¢Session¶ÔÏó
µ±Óû§µÇ½ÍøÕ¾£¬ÏµÍ³½«ÎªËûÉú³ÉÒ»¸ö¶ÀÒ»ÎÞ¶þµÄSession¶ÔÏó£¬ÓÃÒԼǼ¸ÄÓû§µÄ¸öÈËÐÅÏ¢
£¬Ò»µ©¸ÄÓû§Í˳öÍøÕ¾£¬ÄÇô¸ÃSession¶ÔÏ󽫻á×¢Ïú¡£Session¶ÔÏó¿ÉÒÔ°ó¶¨Èô¸É¸öÈËÐÅÏ¢»ò
ÕßJava¶ÔÏ󣬲»Í¬Session¶ÔÏóµÄͬÃû±äÁ¿ÊDz»»áÏ໥¸ÉÈŵġ£
getValue(String name)¡¢putValue(String name)¡¢removeValue(String name)¡¢getValueNames()
¡¢getCreationTime()¡¢getId()¡¢getLastAccessedTime()¡¢getMaxInactiveInterval()¡¢
setMaxInactiveInterval()·½·¨£º
Æä
Ïà¹ØÎĵµ£º
Perl¡¢PHP¡¢ASP¡¢JSP¼¼Êõ±È½Ï
±¾ÎĽ«¶ÔÄ¿Ç°×î³£ÓõÄËÄÖÖ¶¯Ì¬ÍøÒ³ÓïÑÔPerl£¨Practical Extraction and Report Language£©¡¢PHP£¨Hypertext Preprocessor£©¡¢ASP£¨Active Server Pages£©¡¢JSP£¨JavaServer Pages£©½øÐÐһЩ¼¼ÊõÐԵıȽϡ£
¡¡¡¡Perl
¡¡¡¡Perl£¨Practical Extraction and Report Language£©ÊÇÒ»ÖֺܹÅÀϵĽű ......
response.setContentType( "application/pdf" ); // MIME type for pdf doc
response.setHeader("Content-Disposition","attachment;filename=output.pdf;");
Sets the Content-Type header. Content-Type identifies the MIME type of the response document and the character set encoding.
To se ......
JSPÔʼ´úÂëÖаüº¬ÁËJSPÔªËغÍTemplate(Ä£°å) dataÁ½Àà
Template dataÖ¸µÄÊÇJSPÒýÇæ²»´¦ÀíµÄ²¿·Ö£¬¼´±ê¼Ç<%……%>ÒÔÍâµÄ²¿·Ö£¬
ÀýÈç´úÂëÖеÄHTMLµÄÄÚÈÝµÈ £¬ÕâЩÊý¾Ý»áÖ±½Ó´«Ë͵½¿Í»§¶ËµÄä¯ÀÀÆ÷
JSPÔªËØÔòÊÇÖ¸½«ÓÉJSPÒýÇæÖ±½Ó´¦ÀíµÄ²¿·Ö£¬ÕâÒ»²¿·Ö±ØÐë·ûºÏJSPÓï·¨£¬
·ñÔò»áµ¼Ö±àÒë´íÎó¡£
¶ ......
ÏÂÃæµÄÊÇÒ»¸öÔËÐÐЧ¹û£º
·þÎñÆ÷»·¾³±äÁ¿
¹¦ÄܼòÊö
localhost¡¡
·þÎñÆ÷µÄÓòÃû
192.168.0.5¡¡
·þÎñÆ÷µÄIPµØÖ·
Windows XP¡¡
·þÎñÆ÷²Ù×÷ϵͳ
1.6.0¡¡
·þÎñÆ÷ Java ÐéÄâ»ú°æ±¾
2.5¡¡
·þÎñÆ÷Ö§³ÖµÄ Servlet API °æ±¾
2.1¡¡
·þÎñÆ÷Ö§³ÖµÄ JSP API °æ±¾
Apache Tomcat/6.0.16¡¡
·þÎñÆ÷Èí¼þµÄÃû³Æ¼°°æ±¾(½ ......
javaµ¼Èëµ¼³öexcel²Ù×÷(jxl)£¨1£©
¹Ø¼ü×Ö: javaµ¼Èëµ¼³öexcel²Ù×÷(jxl)£¨1£©
jxl.jar °ü
ÏÂÔصØÖ·:
http://www.andykhan.com/jexcelapi/
ÕæʵÏÂÔصØÖ·:
http://www.andykhan.com/jexcelapi/download.html
ÍøÕ¾É϶ÔËüµÄÌØÕ÷ÓÐÈçÏÂÃèÊö£º
¡ñ Ö§³ÖExcel 95-2000µÄËùÓа汾
¡ñ Éú³ÉExcel 2000±ê×¼¸ñʽ
¡ñ Ö§³Ö×ÖÌå¡¢ ......