怎样用jsp画图

wzs_wzs123 2002-03-23 01:38:34
加精
怎样用jsp画图
...全文
67 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
scarab 2002-03-25
  • 打赏
  • 举报
回复
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
import java.util.*;
import com.sun.image.codec.jpeg.*;
import java.awt.image.*;
import java.awt.*;
public class JPEGServlet extends HttpServlet {
//Process the HTTP Get request
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("image/jpeg");
ServletOutputStream out = response.getOutputStream();
BufferedImage image = new BufferedImage(100,100, BufferedImage.TYPE_INT_RGB);
Graphics g = image.getGraphics();
g.setColor(Color.green);
g.fillRect(0, 0, 100, 100);
g.setColor(Color.red);
g.drawOval(0, 0, 100,100);
JPEGImageEncoder encoder =JPEGCodec.createJPEGEncoder(out);
encoder.encode(image);
out.close();
}
//Process the HTTP Post request
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
doGet(request,response);
}
//Get Servlet information
public String getServletInfo() {
return "JPEGServlet Information";
}
}
lvhen 2002-03-25
  • 打赏
  • 举报
回复
画图用applet呀
wzs_wzs123 2002-03-25
  • 打赏
  • 举报
回复
可以发给我一份吗,我的邮箱是wzs_wzs@263.net
scarab 2002-03-25
  • 打赏
  • 举报
回复
用servlet是可以的。我这有代码
jacob1 2002-03-25
  • 打赏
  • 举报
回复
是数据统计图的意思么?
epowerlab 2002-03-24
  • 打赏
  • 举报
回复
什么意思啊
你是指想在页面里画图是不是?
装载applet不就(对applet不懂)
scarab 2002-03-24
  • 打赏
  • 举报
回复
用servlet画图

需要吗?
wzs_wzs123 2002-03-23
  • 打赏
  • 举报
回复
这里没人吗

81,092

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧