JSPÎÞË¢ÐÂÑéÖ¤Âë
´ËʵÏÖ¹²·ÖÈý¸öÎļþ£¬¼´£ºCreatImage.java Éú³ÉͼÏñÁ÷µÄÀ࣬ÌṩÓÃÓÚÉú³ÉͼƬÁ÷µÄ·½·¨£»images.jsp ͼƬ°ü×°£¬ÓÃÓÚ½«Í¼Æ¬¼ÓÈëµ½responseÊä³öÁ÷ÖУ»login.jsp µ÷ÓÃÇ°ÃæµÄjsp£¬ÏÔʾÑéÖ¤Âë¡£
CreatImage.java Àࣺ
3 import java.awt.Color;
4 import java.awt.Font;
5 import java.awt.Graphics;
6 import java.awt.Image;
7 import java.awt.image.BufferedImage;
8 import java.util.Random;
9
10 import javax.servlet.http.HttpServletRequest;
11 import javax.servlet.http.HttpServletResponse;
12 import javax.servlet.http.HttpSession;
13
14 public class CreatImage{
15
16 private static final long serialVersionUID = 1L;
17 Image image = null;
18 HttpServletRequest request = null;
19 HttpServletResponse response = null;
20
21 public CreatImage(HttpServletRequest request, HttpServletResponse response){
22 this.request = request;
23 this.response = response;
24 }
25
26 public Color getRandColor(int fc,int bc){//¸ø¶¨·¶Î§»ñµÃËæ»úÑÕÉ«
27 Random random = new Random();
28 if(fc>255) fc=255;
29 if(bc>255) bc=255;
30 int r=fc random.nextInt(bc-fc);
31 int g=fc random.nextInt(bc-fc);
32 int b=fc random.nextInt(bc-fc);
33 return new Color(r,g,b);
34 }
35
36 public BufferedImage creatImage(){
37
Ïà¹ØÎĵµ£º
¶þÕßÇø±ðÊÇ£º
forwardʵ¼ÊÉÏÊÇÇëÇóÔÚ·þÎñÆ÷¶ËÌø×ª£¬ÇëÇó·½ÊǸÐÖª²»µ½ÕâÖÖÌø×ªµÄ£¬¶øsendRedirectÊÇÇëÇóÔÚ¿Í»§¶ËÌø×ª£¨±ÈÈçIE£©£¬µÈÓÚÔٴδӿͻ§¶Ë·¢ËÍÁËÒ»¸öÇëÇó£¬forwardÇé¿öÏÂÓû§ÔÚµØÖ·À¸ÀïÊÇ¿´²»µ½Ìø×ªºóµÄµØÖ·µÄ£¬sendRedirectÔò¿ÉÒÔ¿´µ½ÐµÄÇëÇóµØÖ·¡£ ......
¼òµ¥½éÉÜJSPÊý¾Ý¿â²Ù×÷µÄ3¸öС¼¼ÇÉ£ºÊý¾ÝÅÅÐò£¬Ö÷/´Ó±í´¦Àí£¬ÊÂÎñ´¦Àí¡£
1¡¡Êý¾ÝÅÅÐò
ÔÚÊý¾Ý¿â¼¼ÊõÖУ¬¿ÉÒÔʹÓÃORDER×Ó¾ä¶Ô²éѯ½á¹û½øÐÐÅÅÐò
[ ORDER BY { order_by_exdivssion[ ASC | DESC]} [ ¸…n ] ]
ÆäÖУ¬order_by_exdivssionÓÃÀ´Ö¸¶¨ÒªÅÅÐòµÄÁУ»ASCÖ¸¶¨°´µÝÔö˳ÐòÅÅÁУ»DESCÖ¸¶¨°´µÝ¼õ˳ÐòÅÅÐò ......
1.RequestDispatcher.forward()
ÊÇÔÚ·þÎñÆ÷¶ËÆð×÷ÓÃ,µ±Ê¹ÓÃforward()ʱ,Servlet engine´«µÝHTTPÇëÇó´Óµ±Ç°µÄServlet or JSPµ½ÁíÍâÒ»¸öServlet,JSP »òÆÕͨHTMLÎļþ,Ò²¼´ÄãµÄformÌá½»ÖÁa.jsp,ÔÚa.jspÓõ½ÁËforward()ÖØ¶¨ÏòÖÁb.jsp,´ËʱformÌá½»µÄËùÓÐÐÅÏ¢ÔÚb.jsp¶¼¿ÉÒÔ»ñµÃ,²ÎÊý×Ô¶¯´«µÝ.
µ«forward()ÎÞ·¨Öض ......
ÔÎĵØÖ·£ºhttp://hi.baidu.com/wangking/blog/item/8a109423ff3d2341ac34dec9.html
ÔÚJava web¿ª·¢Öг£»áʹÓõ½¹¦ÄÜÇ¿´óµÄ¹ýÂËÆ÷£¬Ëû±Ï¾¹ÄܸøÎÒÃÇ´øÀ´ºÜ´óµÄ·½±ã£¬µ«ÊÇÕë¶Ô¹ýÂ˵Ä×ÊÔ´ÎÒÃÇÐèÒªÏêϸµÄÁ˽âËûÃÇÔÚweb.xmlÖеÄÅäÖÃÐÅÏ¢¡£Õâ¸ö¸ù¾Ý¼¸ÖÖ³£ÓõIJ»Í¬Çé¿ö½øÐÐÁË×ܽ᣺
1¡£Èç¹ûÒªÓ³Éä¹ýÂËÓ¦ÓóÌÐòÖÐËùÓÐ×ÊÔ´£º
< ......