Jsp³£Óü¼ÇÉ:ͼƬÑéÖ¤Âë
Jsp³£Óü¼ÇÉ:ͼƬÑéÖ¤Âë
2009Äê10ÔÂ30ÈÕ ÐÇÆÚÎå 21:06
˼·
£º
ͼƬÑéÖ¤ÂëµÄʵÏÖÖ÷ÒªµÄ¼¼ÊõµãÊÇÈçºÎÉú³ÉÒ»¸öͼƬ¡£Éú³ÉͼƬ¿ÉÒÔʹÓÃjava.awt°üϵÄÀàÀ´ÊµÏÖ¡£ÎÒÃÇÏÈдһ¸ö¼òµ¥µÄÉú³ÉͼƬµÄ³ÌÐòHelloImage.java¡£ÒÔÏÂÊÇ´úÂ벿·Ö¡£
package com.vogoal.test;
import java.awt.Color;
import
java.awt.Graphics;
import java.awt.image.BufferedImage;
import
java.io.File;
import java.io.IOException;
import
javax.imageio.ImageIO;
/**
* @author SinNeR@blueidea.com
* create a
image
*/
public class HelloImage {
public static void main(String[]
args){
BufferedImage image = new BufferedImage(80,
25,
BufferedImage.TYPE_INT_RGB);
Graphics g =
image.getGraphics();
g.setColor(new Color(255,255,255));
g.fillRect(0, 0, 80, 25);
g.setColor(new Color(0,0,0));
g.drawString("HelloImage",6,16);
g.dispose();
try{
ImageIO.write(image, "jpeg", new
File("C:\\helloImage.jpeg"));
}catch(IOException e){
e.printStackTrace();
}
}
}
±àÒëºó£¬ÔÚDOSϵ÷ÓÃÕâ¸ö³ÌÐò£¬Õý³£Çé¿öÏ£¬»áÔÚCÅ̸ùĿ¼ÏÂÉú³ÉÒ»ÕÅÃû×ÖhelloImage.jpegΪµÄͼƬ¡£Í¼Æ¬ÉÏÓÐÎÄ×ÖHelloImage¡£
¼òµ¥½éÉÜÏÂÉú³ÉͼƬµÄÁ÷³Ì
£º
½¨Á¢BufferedImage¶ÔÏó¡£Ö¸¶¨Í¼Æ¬µÄ³¤¶È¿í¶ÈºÍÉ«²Ê¡£
BufferedImage image = new
BufferedImage(80,25,BufferedImage.TYPE_INT_RGB);
È¡µÃGraphics¶ÔÏó£¬ÓÃÀ´»æÖÆͼƬ¡£
Graphics g = ima
Ïà¹ØÎĵµ£º
ÕªÒª£ºËäÈ»session»úÖÆÔÚwebÓ¦ÓóÌÐòÖб»²ÉÓÃÒѾºÜ³¤Ê±¼äÁË£¬µ«ÊÇÈÔÈ»ÓкܶàÈ˲»Çå³þsession»úÖƵı¾ÖÊ£¬ÒÔÖÁ²»ÄÜÕýÈ·µÄÓ¦ÓÃÕâÒ»¼¼Êõ¡£±¾ÎĽ«ÏêϸÌÖÂÛsessionµÄ¹¤×÷»úÖƲ¢ÇÒ¶ÔÔÚJava web applicationÖÐÓ¦ÓÃsession»úÖÆʱ³£¼ûµÄÎÊÌâ×÷³ö½â´ð¡£
Ŀ¼£º
Ò»¡¢ÊõÓïsession
¶þ¡¢HTTPÐÒéÓë״̬±£³Ö
Èý¡¢Àí½âcookie» ......
Ò»¡¢page ¶ÔÏó
¡¡¡¡page¶ÔÏó´ú±íJSP±¾Éí£¬¸ü׼ȷµØ˵Ëü´ú±íJSP±»×ªÒëºóµÄServlet£¬Ëü¿ÉÒÔµ÷ÓÃServletÀàËù¶¨ÒåµÄ·½·¨¡£
¡¡¡¡¶þ¡¢config ¶ÔÏó
¡¡¡¡config ¶ÔÏóÀï´æ·Å×ÅһЩServlet ³õʼµÄÊý¾Ý½á¹¹¡£
¡¡¡¡config ¶ÔÏóʵÏÖÓÚjavax.servlet.ServletConfig ½Ó¿Ú£¬Ëü¹²ÓÐÏÂÁÐËÄÖÖ·½·¨£º
......
1£º³¬Á¬½ÓÌøת
ÎÒÃÇÔÚ³¬Á¬½ÓµÄʱºò£¬³£³£Á¬½Óµ½Ò»¸öjsp»òÕßAction,±ÈÈç:
XXX
ÕâÑù×ö»áÓÐÒ»¸öÎÊÌ⣺ÔÚtest.jspÖУ¬³ýÄã´«µÝµÄparam1ºÍparam2²ÎÊýÍâ,ÄãÓÃrequest.getParamter()È¡ÈκÎÔÀ´Ò³ÃæµÄ±íµ¥ÔªËض¼»áΪ¿Õ£¬ÕâÊÇÒòΪÕâÖÖ·½Ê½»á²úÉúеÄrequestÉúÃüÖÜÆÚ£¬ÔÚÕâ¸örequestÖÐÖ»»á°üº¬³¬Á¬½Óºó¸úËæµÄ?param1ÕâÖÖ²ÎÊý£¬ Òò´ ......
ÔÚÓ¦ÓóÌÐò¿ª·¢µÄʱºò·ÖÒ³ÓÐÁ½ÖÖ:Õæ·ÖÒ³ºÍ¼Ù·ÖÒ³£¬¼Ù·ÖÒ³Òª°ÑËùÓÐÊý¾ÝÏÈÌáÈ¡³öÀ´·Åµ½Ò»¸ölist¼¯ºÏÀï»òÕß¾²Ì¬±äÁ¿ÖС£Õæ·ÖÒ³ÔòÊÇÐèÒªÓõ½¼¸ÐÐÊý¾ÝÔÙ´ÓÊý¾Ý¿âÖÐÌáÈ¡³öÀ´·Å°ÑÐèÒªÏÔʾµÄÊý¾Ý·Åµ½list¼¯ºÏÀï¡£µ«ÎÞÂÛÕæ·ÖÒ³¼Ù·ÖÒ³pager-taglib¶¼¿ÉÒԺܺõÄΪÎÒÃǽøÐд¦Àí¡£
1.ÏÂÔØpager-taglib
ÏÂÔØµØ ......