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

jsp¼òµ¥µÄÑéÖ¤Âë

1.Ê×ÏÈÔÚjspÒ³ÃæÖÐÉú³ÉÑéÖ¤ÂëͼƬ£¬image.jsp
   <%@ page contentType="image/jpeg"%>
<%@ page import="java.awt.*,java.awt.image.*,java.util.*,javax.imageio.*" %>
<%!
Color getRandColor(int fc,int bc){//¸ø¶¨·¶Î§»ñµÃËæ»úÑÕÉ«
Random random = new Random();
if(fc>255) fc=255;
if(bc>255) bc=255;
int r=fc+random.nextInt(bc-fc);
int g=fc+random.nextInt(bc-fc);
int b=fc+random.nextInt(bc-fc);
return new Color(r,g,b);
}
%>
<%
//ÉèÖÃÒ³Ãæ²»»º´æ
response.setHeader("Pragma","No-cache");
response.setHeader("Cache-Control","no-cache");
response.setDateHeader("Expires", 0);
// ÔÚÄÚ´æÖд´½¨Í¼Ïó
int width=60, height=20;
BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
// »ñȡͼÐÎÉÏÏÂÎÄ
Graphics g = image.getGraphics();
//Éú³ÉËæ»úÀà
Random random = new Random();
// É趨±³¾°É«
g.setColor(getRandColor(200,250));
g.fillRect(0, 0, width, height);
//É趨×ÖÌå
g.setFont(new Font("Times New Roman",Font.PLAIN,18));
//»­±ß¿ò
//g.setColor(new Color());
//g.drawRect(0,0,width-1,height-1);
// Ëæ»ú²úÉú155Ìõ¸ÉÈÅÏߣ¬Ê¹Í¼ÏóÖеÄÈÏÖ¤Âë²»Ò×±»ÆäËü³ÌÐò̽²âµ½
g.setColor(getRandColor(160,200));
for (int i=0;i<155;i++)
{
int x = random.nextInt(width);
int y = random.nextInt(height);
int xl = random.nextInt(12);
int yl = random.nextInt(12);
g.drawLine(x,y,x+xl,y+yl);
}
// È¡Ëæ»ú²úÉúµÄÈÏÖ¤Âë(4λÊý×Ö)
String sRand="";
for (int i=0;i<4;i++){
String rand=String.valueOf(random.nextInt(10));
sRand+=rand;
// ½«ÈÏÖ¤ÂëÏÔʾµ½Í¼ÏóÖÐ
g.setColor(new Color(20+random.nextInt(110),20+random.nextInt(110),20+random.nextInt(110)));//µ÷Óú¯Êý³öÀ´µÄÑÕÉ«Ïàͬ£¬¿ÉÄÜÊÇÒòΪÖÖ×ÓÌ«½Ó½ü£¬ËùÒÔÖ»ÄÜÖ±½ÓÉú³É
g.drawString(rand,13*i+6,1


Ïà¹ØÎĵµ£º

jspÁ¬½ÓÊý¾Ý¿âÈ«¼¯

¡¡ÏÖÔÚÓкöà³õѧjspµÄÍøÓѾ­³£»áÎÊÊý¾Ý¿âÔõôÁ¬½Ó°¡£¬ÔõôÀϳö´í°¡£¿ËùÒÔÎÒ¼¯ÖеÄÔÚÕâдƪÎÄÕ¹©´ó¼Ò²Î¿¼£¬ÆäʵÕâÖÖ°ÑÊý¾Ý¿âÂß¼­È«²¿·ÅÔÚjspÀïδ±ØÊǺõÄ×ö·¨£¬µ«ÊÇÓÐÀûÓÚ³õѧÕßѧϰ£¬ËùÒÔÎÒ¾ÍÕâÑù×öÁË£¬µ±´ó¼Òѧµ½Ò»¶¨³Ì¶ÈµÄʱºò£¬¿ÉÒÔ¿¼ÂÇÓÃMVCµÄģʽ¿ª·¢¡£ÔÚÁ·Ï°ÕâЩ´úÂëµÄʱºò£¬ÄãÒ»¶¨½«jdbcµÄÇý¶¯³ÌÐò·Åµ½·þÎñÆ÷µÄÀà ......

jspÁ¬½ÓÊý¾Ý¿â

 <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<%@ page contentType="text/html; charset=gb2312" language="java"
import="java.sql.*"%>
<%  
    /*********************
  &nb ......

MyEclipse±à¼­JspËÀ»úÎÊÌâ

MyEclipse±à¼­JspËÀ»úÎÊÌâ
Õâ¸öÎÊÌâµÄÈ·ºÜ·³ÈË£¬Æäʵ¶¼ÊÇMyEclipseµÄ“×Ô×÷´ÏÃ÷”ºÍ·ÃÎÊÍøÂçÉϵÄAPI DocµÄ½á¹û£¨ËüĬÈÏÓÃVisual DesignerÀ´´ò¿ªµÄ£©£¬½øÐÐÏÂÁÐÉèÖü´¿ÉÓÐЧ»º½âÖ®¡£
1. ҪôÓÒ¼üµ¥»÷Îļþ£¬Ñ¡Ôñ Open With -¡· MyEclipse JSP Editor ´ò¿ª£¬ÕâÑù²»»á²ÉÓÿÉÊÓ»¯µÄ´ò¿ª£¬ºÄ×ÊÔ´ÉÙ£¬×Ô¶¯ÌáʾҲ·Ç³£¿ì ......

JSP ÈçºÎʵÏÖÍøÒ³¶¨Ê±Ìøת:


JSP ÈçºÎʵÏÖÍøÒ³¶¨Ê±Ìøת: 
<script   language="javascript">  
  <!--  
  setTimeout("document.location.href='http://www.163.com'",3000);  
  //-->  
  </script>
ˢУº
<meta   http-equiv="Refresh"   content ......

³£ÓÃjsp¼¼ÇÉ

1. ÈçºÎÈÃÑ¡ÖеÄÒ»ÐмǼ¸ßÁÁÏÔʾ£¿
http://topic.csdn.net/t/20050105/09/3699823.html
2. ÈçºÎÔÚÏÂÀ­Áбí¿òÀïÑ¡ÔñÒ»¸öÖµºóÌø³öд°¿Ú?
http://topic.csdn.net/t/20050107/15/3707444.html
3. ÈçºÎÔÚJSPÖÐÆô¶¯execl?
http://community.csdn.net/Expert/TopicView1.asp?id=4909154
http://community.csdn.net/Expert/ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ