×ܽ᣺JSPÒ³ÃæimgͼƬ»º´æÎÊÌâÏÖÏó±íÊö¼°ÎÊÌâ½â¾ö
JSPÒ³ÃæimgͼƬ»º´æÎÊÌâÏÖÏó±íÊö¼°ÎÊÌâ½â¾ö
l ÎÊÌâ±íÊö£º
µ±¶Ôº¬ÓÐÍ·ÏñµÄ¿Í·þÈËÔ±ÐÅÏ¢½øÐÐÐÞ¸Ä(º¬¶ÔÍ·ÏñÐÅÏ¢µÄÐÞ¸Ä)ºó£¬ÖØдò¿ªÊý¾ÝÐ޸ĽçÃ棬·¢ÏÖÎı¾ÄÚÈÝÐ޸ijɹ¦£¬¶øÍ·ÏñÄÚÈÝÈÔÈ»ÏÔʾΪÔÀ´µÄÍ·Ïñ——Êý¾Ý¿âÖеĶÔÓ¦ÐÅϢͷÏñËùÔÚ×Ö¶ÎÊý¾ÝÒѾ³É¹¦¸üС£
l Ç°Ì᣺
jspÒ³ÃæÖнøÐÐÁËÒ³Ã滺´æÇå³ý´¦Àí£º
<meta http-equiv="pragma" content="no-cache"/>
<meta http-equiv="cache-control" content="no-cache"/>
<meta http-equiv="expires" content="0"/>
µ±È»£¬Ï±ß3ÐдúÂ빦ÄÜÓëÉϱߵÄ3Ðй¦ÄÜÏàͬ£¬Ò³ÃæÖнöдһ·Ý
<%
response.setHeader("Pragma","No-Cache");
response.setHeader("Cache-Control","No-Cache");
response.setDateHeader("Expires", 0);
%>
l ÎÊÌâÇé¾°ÔÙÏÖ£º
ÔjspÖÐimg srcд·¨£º
<img src="<%=path%>/servlet/customer/personPic?cspId=${cspId}"></img>
ÒªÐ޸ĵÄÊý¾Ý½çÃ棺
ÐÞ¸ÄÊý¾Ýºó£¬ÔٴνøÈë´ËÌõÊý¾ÝµÄÐ޸ĽçÃ棺
·¢ÏÖËäÈ»ÆäËüÎı¾×ֶζ¼½øÐÐÁËÏàÓ¦Ð޸ģ¬µ«ÊÇ“Í·Ïñ”²¿·Ö²¢Ã»ÓÐÐÞ¸ÄΪÎÒÃÇÖ¸¶¨µÄͼƬ(ÈçÏÂͼ,Í·ÏñÈÔÈ»ÏÔʾΪһ¸ö“²æ”µÄÐÎ×´)
²éѯÊý¾Ý¿â£¬·¢ÏÖÊý¾Ý¿âÖеÄÍ·Ïñ¶ÔÓ¦µÄblob×Ö¶ÎÖеÄÊý¾ÝÒѾ¸ü¸ÄΪָ¶¨µÄͼƬ¡£
l ÎÊÌâ½â¾ö(¹²Á½²½)£º
£¨1£©ÐÞ¸Äservlet£ºÔÚ½øÐÐÊý¾Ý¶ÁÈ¡µÄservletÖÐÔö¼ÓͼƬËæ»úÊý´úÂë
//ͼƬËæ»úÊý
double randomNum = Math.random();
request.setAttribute("randomNum", randomNum);
£¨2£©¸üÐÂǰ̨Êý¾ÝÐÞ¸Äjsp£ºÍ¼Æ¬ÏÔʾimg±êÇ©µÄsrcÖÐÔö¼Ó“randomNum”²ÎÊý
<img src="<%=path%>/servlet/customer/personPic?cspId=${cspId}&randomNum=${randomNum}"></img>
ÖØдò¿ªÍ¬Ò»ÈËÔ±µÄÊý¾ÝÐ޸ĽçÃæ——³É¹¦ÏÔʾ¸Õ²Å¸üйýµÄͼƬ£¡£¡
l ÔÀí£º
ÓÉÓÚÔÚimgµÄsrcÖÐÔö¼ÓÁËËæ»úÊý²ÎÊý£¬¶à´Î·ÃÎÊͼƬʱ£¬ä¯ÀÀÆ÷ÈÏΪÊÇ·ÃÎÊÁ˲»Í¬µÄͼƬ·¾¶(»òÕß˵ÊÇ·ÃÎÊÁ˲»Í¬µÄͼƬ£©£¬ä¯ÀÀÆ÷»áÿ´ÎÖØзÃÎÊ·þÎñÆ÷¶ÁȡͼƬ£¬¶ø²»ÔÙ¶ÁÈ¡»º´æÖеÄͼƬ¡£
Ïà¹Ø²Î¿¼£º
JspÒ³ÃæÖйØÓÚ¿Í»§¶ËͼƬ»º´æµÄ½â¾ö
Ïà¹ØÎĵµ£º
Ê×ÏÈÄãÒªÓÐtomcat,»¹ÒªÓÐoracle jdbcµÄjarµµµÈ»·¾³.
µÚÒ»²½: дJSP
<%@ page contentType="text/html;charset=gb2312"%>
<%@ page import="java.sql.*"%>
<html>
<body>
<%Class.forName("oracle.jdbc.driver.OracleDriver").newInstance();
String url="jdbc:oracle:thin:@(des ......
Ò» Ç°Ìá
Ï£Íû×îеļͼÔÚ¿ªÍ·¸øÄãµÄ±í½¨Á¢²éѯ£º
񡜧mytable
²éѯ£ºcreate or replace view as mytable_view from mytable order by id desc ÆäÖУ¬×îºÃʹÓÃÐòÁкÅcreate sequence mytable_sequence À´×Ô¶¯Ôö¼ÓÄãµÄ¼ ......
JSP¾ÅÖÖÄÚÖöÔÏñ£¬²»Óö¨Òå¿ÉÖ±½ÓʹÓãºrequest,ÇëÇó¶ÔÏó£»response,ÏìÓ¦¶ÔÏó£»pageContext,Ò³ÃæÉÏÏÂÎĶÔÏó£»session,»á»°¶ÔÏó£»application,Ó¦ÓóÌÐò¶ÔÏó£»out,Êä³ö¶ÔÏó£»config,ÅäÖöÔÏó£»page,Ò³Ãæ¶ÔÏó£»exception£¬ÀýÍâ¶ÔÏó¡£
......
jQueryÊÇÄ¿Ç°Ò»¸öºÜÁ÷ÐеÄjs¿ò¼Ü£¬ËüÒ²ÌṩÁ˶ÔajaxºÜºÃµÄÖ§³Ö¡£Ê¹ÓÃajaxÒì²½ÇëÇóÊý¾Ýʱ£¬Èç¹û·þÎñÆ÷·µ»ØµÄÒ»¸öÁбíÊý¾Ý£¬Í¨³£µÄ×ö·¨ÊÇ°ÑÁбíÊý¾Ýת»»³Éjson¸ñʽµÄÊý¾Ý£¬È»ºó·µ»Øµ½Ò³Ã棬ʹÓÃjQuery½øÐнâÎö²¢Óñí¸ñÀ´ÏÔʾ£¬ÕâÒªÇóÄã¶Ôjavascript½âÎöjsonºÜÊì͸¡£
ÎÒÔÚÕâÀïÌṩһÖÖͶ»úÈ¡ÇɵÄ×ö·¨£¬Ê¹ÓÃjQuery·¢ËÍÒì²½ÇëÇó ......