验证码的问题,windows下能正常显示图片,aix下不行,200份急寻解决方案!

kinglht 2004-07-27 04:54:17
<%@ page contentType="image/jpeg"
import="java.awt.*,java.awt.image.*,
com.sun.image.codec.jpeg.*,java.util.*"
%>
<%
//设置页面不缓存
response.setHeader("Pragma","No-cache");
response.setHeader("Cache-Control","no-cache");
response.setDateHeader("Expires", 0);

try{
Font mFont=new Font("宋体", Font.PLAIN,12);//设置字体
//取得一个1000-9999的随机数
String s="";
int intCount=0;
intCount=(new Random()).nextInt(9999);//
if(intCount<1000)intCount+=1000;
s=intCount+"";
//对session付值。
session.setAttribute("getImg",s);
response.setContentType("image/jpeg");
BufferedImage image=new BufferedImage(35,14,BufferedImage.TYPE_INT_RGB);
Graphics gra=image.getGraphics();
//设置背景色
gra.setColor(Color.yellow);
gra.fillRect(1,1,33,12);
//设置字体色
gra.setColor(Color.black);
gra.setFont(mFont);
//输出数字
char c;
for(int i=0;i<4;i++) {
c=s.charAt(i);
gra.drawString(c+"",i*7+4,11); //7为宽度,11为上下高度位置
}
//JPEGImageEncoder encoder=
com.sun.image.codec.jpeg.JPEGCodec.createJPEGEncoder(response.getOutputStream()).encode(image);
}
catch(Exception e){
response.getOutputStream().close();
}
%>
...全文
101 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
kman2005 2005-05-24
  • 打赏
  • 举报
回复
6月,一个价值1000元的帖子即将诞生!

时代重英豪,网络教尔曹,万般皆下品,唯有发帖高!
我是有名的水王,可到处遭到版主封杀,网络之大竟无一块版面让俺痛快一灌,发帖还能拿奖?俺倒是曾经梦见过。
我喜欢跟大家分享,好文章,好资源……。有人喜欢,我已经很开心,转载也有奖金?真是从来没见过。

现金大奖:
一等奖(一名):现金1000元
二等奖(一名):现金500元
三等奖(一名):现金300元
优秀奖(7名):现金100元

你没听说过、没见过、认为不可能的,今天统统推翻!上Kman论坛(http://www.kman.com.cn/kmanforum/forum/index),你的发帖够精彩,回帖的人够多,1000元就是你的!!
winespirit 2005-05-24
  • 打赏
  • 举报
回复
在xwindows模式下面启动websphere,不要在telnet中启动
yyqllxh2004 2004-08-16
  • 打赏
  • 举报
回复
http://community.csdn.net/Expert/topic/3277/3277601.xml?temp=.4000513
试一下
朋友别哭 2004-08-02
  • 打赏
  • 举报
回复
up
king1012 2004-08-02
  • 打赏
  • 举报
回复
http://community.csdn.net/Expert/topic/2847/2847449.xml?temp=.5038874

http://community.csdn.net/Expert/topic/3166/3166436.xml?temp=.4348566
kinglht 2004-07-27
  • 打赏
  • 举报
回复
http://community.csdn.net/Expert/topic/3177/3177525.xml?temp=.6582605这里还有100分,就散给各位兄弟了~!!
kinglht 2004-07-27
  • 打赏
  • 举报
回复
systemOut.log里面报[Servlet Error]-[sun/awt/X11GraphicsEnvironment]: java.lang.NoClassDefFoundError: sun/awt/X11GraphicsEnvironment这个错误,这个类到哪里找啊,拜托各位大虾,帮帮忙啊

81,092

社区成员

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

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