验证码 验证码 1、验证码 1)生成验证码图片 (使用servlet或者jsp生成一个图片) step1 response.setContentType("image/jpeg"); step2 使用java.awt.*生成一个图片 step3 压缩图片 step4 使用OutputStream输出图片 OutputStream ips = response.getOutputStream(); 2)使用验证码 step1 在session中绑订验证码 step2 在用户提交数据之后,比较session中 预先绑订的验证码与提交的验证证,如果相等, 则处理请求,否则提示用户重新填写验证码。 2、购物车 表: create table t_computer( id bigint primary key auto_increment, model varchar(50), pic varchar(50), prodInfo text, price double); insert into t_computer(model,pic,prodInfo,price) values('x200','x200.jpg','挺不错',2000); insert into t_computer(model,pic,prodInfo,price) values('x500','x500.jpg','挺不错',5000); insert into t_computer(model,pic,prodInfo,price) values('x600','x600.jpg','挺不错',6000);