LionSky.Net

我一直以为悲伤是一种美丽,一种壮丽,这世界让我如此失望,我经不起这风吹雨打的折磨,我寻找的是悲惨的结局,我追寻的是哭里的笑声,默默地完成生命的剩余……如果有来生,我不会选择以悲伤为开始,我会选择以美丽为结局......

侯建勋ID:houjianxun
34777次访问,排名3250(-1)好友8人,关注者14
houjianxun的文章
原创 27 篇
翻译 0 篇
转载 0 篇
评论 44 篇
lion的公告
If you have a dream, do everything for it! If you happy, more happy for you are the happy owner!
If you want happyness, happy in learning, happy in working, and happy in life!
Feel better? Smile ! Believe that everything will be better and better!

最近评论
xiaofen2001:这文章和参考资料3的 如何利用客户端缓存对网站进行优化? 有什么不一样?好像一样啊 汗
mjohnhai:为什么不用asp.net的 @OutputCache 指令?
这个到底有什么实用价值?
seeplus:使用304只是方法之一,还有些HTTP头是控制代理服务器缓存的,某些情况下也很有用。
program_net:这文章好
hyz_6:Good ! Happy in reading
文章分类
收藏
相册
存档
软件项目交易
订阅我的博客
XML聚合  FeedSky
订阅到鲜果
订阅到Google
订阅到抓虾
订阅到BlogLines
订阅到Yahoo
订阅到GouGou
订阅到飞鸽
订阅到Rojo
订阅到newsgator
订阅到netvibes

原创 JSP中在内存中生成的图片显示到页面中收藏

新一篇: 在C#中实现高性能计时 | 旧一篇: 在JSP中实现DES加密解密的例子

下载:点击下载
演示:本站暂时不支持JSP空间


Imaging_ToWeb.jsp

<%@ page autoFlush="false"  import="java.awt.*,java.awt.image.*,com.sun.image.codec.jpeg.*,java.util.*"%>
<%
    String ImageStr = request.getParameter("ID_Text");
    if(ImageStr==null || ImageStr.equals(""))
    {
        response.setContentType("text/html; charset=gb2312");
 %>
<HTML>
 <HEAD>
  <title>Http://www.lionsky.net</title>
  <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
 </HEAD>
 <body>
  <form id="Form1" method="post">
    <input type="text" id="ID_Text" name=ID_Text>
    <input type=submit value="GO">
  </form>
 </body>
</HTML>

<%
       }
       else
       {
        out.clear();
        response.setContentType("image/jpeg");
        response.addHeader("pragma","NO-cache");
        response.addHeader("Cache-Control","no-cache");
        response.addDateHeader("Expries",0);
        int width=300, height=100;
        BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
        Graphics g = image.getGraphics();
        //以下填充背景颜色
        g.setColor(Color.lightGray);
        g.fillRect(0, 0, width, height);
        String random="random";
        //以下设置前景色
        g.setColor(Color.BLACK);
        g.drawString("Http://www.lionsky.net",10,20);
        g.drawString("Author:Lion[lion-a@sohu.com]",10,40);
        g.drawLine(10,50,290,50);
        g.drawString(ImageStr,10,70);
        g.dispose();
        ServletOutputStream outStream = response.getOutputStream();
        JPEGImageEncoder encoder =JPEGCodec.createJPEGEncoder(outStream);
        encoder.encode(image);
        outStream.close();
    }

%>



发表于 @ 2004年05月26日 13:23:00|评论(loading...)|编辑

新一篇: 在C#中实现高性能计时 | 旧一篇: 在JSP中实现DES加密解密的例子

评论:没有评论。

发表评论  


当前用户设置只有注册用户才能发表评论。如果你没有登录,请点击登录
Csdn Blog version 3.1a
Copyright © lion