日韩天天综合网_野战两个奶头被亲到高潮_亚洲日韩欧美精品综合_av女人天堂污污污_视频一区**字幕无弹窗_国产亚洲欧美小视频_国内性爱精品在线免费视频_国产一级电影在线播放_日韩欧美内地福利_亚洲一二三不卡片区

Servlet動(dòng)態(tài)產(chǎn)生JPEG圖像的例子_JSP教程

編輯Tag賺U幣
教程Tag:暫無(wú)Tag,歡迎添加,賺取U幣!

推薦:jsp 自定義分頁(yè)標(biāo)簽
花了一上午簡(jiǎn)單研究了下自定義標(biāo)簽。就弄了個(gè)自定義的分頁(yè)標(biāo)簽。代碼沒(méi)有怎么仔細(xì)優(yōu)化。先貼上來(lái),:) 1,標(biāo)簽的實(shí)現(xiàn)類NumenTag.java import java.util.ArrayList;import java.util.Has

//GenerateImage.java
/* 動(dòng)態(tài)產(chǎn)生JPEG圖像的例子 */
import java.awt.*;
import java.awt.image.*;
import com.sun.image.codec.jpeg.*; //編碼類
java.util.*;
javax.servlet.*;
javax.servlet.http.*;
java.io.*;


class GenerateImage extends HttpServlet
public void doGet(HttpServletRequest request,HttpServletResponse response)
throws ServletException, java.io.IOException {

response.setContentType("image/jpeg"):
int width=200, height=200;
BufferedImage image = BufferedImage(width,height,BufferedImage.TYPE_INT_RGB);
Graphics g = image.getGraphics();
g.setColor(Color.white);
g.fillRect(0,0,width,heitht);
Polygon poly = new Polygon();
Random random = new Random();
for(int i=0;i<5;i )
{
poly.addPoint(random.nextInt(width),random.nextInt(height));
}
g.setColor(Color.cyan);
g.fillPolygon(poly);
g.dispose(); //消拙Graphics 對(duì)圖形沒(méi)有肖毀

ServletOutputStream sos =response.getOutputStream(); //二進(jìn)制
JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(sos); //創(chuàng)建編碼器,輸出到sos那里
encoder.encode(image);
}

public void doPost(HttpServletRequest request,HttpServletResponse response)
throws ServletException, java.io.IOException {
doGet(request,response);
}

}

http://blog.csdn.net/laiahu/archive/2007/01/23/1491681.aspx

分享:JSP Struts之HTML標(biāo)簽庫(kù)詳解
JSP Struts之HTML標(biāo)簽庫(kù)詳解Struts提供了五個(gè)標(biāo)簽庫(kù),即:HTML、Bean、Logic、Template和Nested。 標(biāo)簽庫(kù) 說(shuō)明 HTML 標(biāo)簽 用來(lái)創(chuàng)建能夠和Struts 框架和其他相應(yīng)的HTML 標(biāo)簽交互的HTML 輸

來(lái)源:模板無(wú)憂//所屬分類:JSP教程/更新時(shí)間:2008-08-22
相關(guān)JSP教程