图片验证码工具类

图形验证码,往往常用,写下来记录一下,便于以后随时使用 

一、图片验证码工具类

import javax.imageio.ImageIO;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.io.IOException;
import java.io.OutputStream;
import java.util.Random;

public class CaptchaCodeUtil {
    /**
     * 验证码图片的宽度
     */
    private  int width=160;
    /**
     * 验证码图片的宽度
     */
    private  int height=40;
    /**
     * 干扰线的数量
     */
    private  int lineCount=20;
    /**
     * 验证码
     */
    private  String  code=null;

    /**
     * 验证码图片上字符个数
     */
    private  int  codeCount=4;

    /**
     * 验证码图片Buffer
     */
    private BufferedImage buffImg = null;

    Random random = new Random();

    public CaptchaCodeUtil(){
         createImageCode();
    }

    /**
     * 指定宽高
     * @param width
     * @param height
     */
    public CaptchaCodeUtil(int width, int height){
        this.width=width;
        this.height=height;
        createImageCode();
    }

    /**
     * 指定宽高和干扰线的数量
     * @param width
     * @param height
     * @param lineCount
     */
    public CaptchaCodeUtil(int width, int height, int lineCount){
        this.width=width;
        this.height=height;
        this.lineCount=lineCount;
        createImageCode();
    }

    /**
     * 指定宽高、验证码字符个数、干扰线数量
     * @param width
     * @param height
     * @param codeCount
     * @param lineCount
     */
    public CaptchaCodeUtil(int width, int height, int codeCount, int lineCount){
        this.width=width;
        this.height=height;
        this.codeCount=codeCount;
        this.lineCount=lineCount;
        createImageCode();
    }

    /**
     * 指定宽高、验证码字符个数、干扰线数量、
     * @param width
     * @param height
     * @param codeCount
     * @param lineCount
     * @param code
     */
    public CaptchaCodeUtil(int width, int height, int codeCount, int lineCount, String code){
        this.width=width;
        this.height=height;
        this.codeCount=codeCount;
        this.lineCount=lineCount;
        createImageCode(code);
    }

    /**
     * 生成验证码
     */
    private void createImageCode(){
        // 字体的宽度
        int fontWidth = width / codeCount;
        // 字体的高度
        int fontHeight = height - 5;
        // 偏移量
        int codeY = height - 8;

        // 图像buffer
        buffImg = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
        Graphics g = buffImg.getGraphics();
        // 设置背景色
        g.setColor(getRandColor(200, 250));
        g.fillRect(0, 0, width, height);

        // 设置字体
        Font font = new Font("Fixedsys", Font.BOLD, fontHeight);
        g.setFont(font);

        // 设置干扰线
        setLine(g);

        // 添加噪点
        // 噪声率
        float yawpRate = 0.01f;
        int area = (int) (yawpRate * width * height);
        for (int i = 0; i < area; i++) {
            int x = random.nextInt(width);
            int y = random.nextInt(height);
            buffImg.setRGB(x, y, random.nextInt(255));
        }
        // 得到随机字符
        String str1 = randomStr(codeCount);
        this.code = str1;
        for (int i = 0; i < codeCount; i++) {
            String strRand = str1.substring(i, i + 1);
            g.setColor(getRandColor(1, 255));
            // a为要画出来的东西,x和y表示要画的东西最左侧字符的基线位于此图形上下文坐标系的 (x, y) 位置处
            g.drawString(strRand, i*fontWidth+3, codeY);
        }

    }
    /**
     * 生成指定字符图片
     */
    private void createImageCode(String code) {
        // 字体的宽度
        int fontWidth = width / codeCount;
        // 字体的高度
        int fontHeight = height - 5;
        int codeY = height - 8;

        // 图像buffer
        buffImg = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
        Graphics g = buffImg.getGraphics();
        // 设置背景色
        g.setColor(getRandColor(200, 250));
        g.fillRect(0, 0, width, height);

        // 设置字体
        Font font = new Font("Fixedsys", Font.BOLD, fontHeight);
        g.setFont(font);

        // 设置干扰线
        setLine(g);

        // 添加噪点
        // 噪声率
        float yawpRate = 0.01f;
        int area = (int) (yawpRate * width * height);
        for (int i = 0; i < area; i++) {
            int x = random.nextInt(width);
            int y = random.nextInt(height);

            buffImg.setRGB(x, y, random.nextInt(255));
        }

        this.code = code;
        for (int i = 0; i < code.length(); i++) {
            String strRand = code.substring(i, i + 1);
            g.setColor(getRandColor(1, 255));
            // a为要画出来的东西,x和y表示要画的东西最左侧字符的基线位于此图形上下文坐标系的 (x, y) 位置处
            g.drawString(strRand, i*fontWidth+3, codeY);
        }

    }

    /**
     * 设置干扰线
     * @param g
     */
    private void setLine(Graphics g){
        for (int i = 0; i < lineCount; i++) {
            int xs = random.nextInt(width);
            int ys = random.nextInt(height);
            int xe = xs + random.nextInt(width);
            int ye = ys + random.nextInt(height);
            g.setColor(getRandColor(1, 255));
            g.drawLine(xs, ys, xe, ye);
        }

    }
    /**
     * 得到随机字符
     * @param n
     * @return
     */
    public String randomStr(int n) {
        String str1 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890";
        String str2 = "";
        int len = str1.length() - 1;
        double r;
        for (int i = 0; i < n; i++) {
            r = (Math.random()) * len;
            str2 = str2 + str1.charAt((int) r);
        }
        return str2;
    }

    /**
     * 得到随机颜色
     * @param fc
     * @param bc
     * @return
     */
    private Color getRandColor(int fc, int bc) {
        // 给定范围获得随机颜色
        if (fc > 255){
            fc = 255;
        }
        if (bc > 255){
            bc = 255;
        }
        int r = fc + random.nextInt(bc - fc);
        int g = fc + random.nextInt(bc - fc);
        int b = fc + random.nextInt(bc - fc);
        return new Color(r, g, b);
    }

    /**
     * 产生随机字体
     */
    private Font getFont(int size) {
        Random random = new Random();
        Font font[] = new Font[5];
        font[0] = new Font("Ravie", Font.PLAIN, size);
        font[1] = new Font("Antique Olive Compact", Font.PLAIN, size);
        font[2] = new Font("Fixedsys", Font.PLAIN, size);
        font[3] = new Font("Wide Latin", Font.PLAIN, size);
        font[4] = new Font("Gill Sans Ultra Bold", Font.PLAIN, size);
        return font[random.nextInt(5)];
    }


    /**
     * 扭曲方法
     * @param g
     * @param w1
     * @param h1
     * @param color
     */
    private void shear(Graphics g, int w1, int h1, Color color) {
        shearX(g, w1, h1, color);
        shearY(g, w1, h1, color);
    }

    private void shearX(Graphics g, int w1, int h1, Color color) {

        int period = random.nextInt(2);

        boolean borderGap = true;
        int frames = 1;
        int phase = random.nextInt(2);

        for (int i = 0; i < h1; i++) {
            double d = (double) (period >> 1)
                    * Math.sin((double) i / (double) period
                    + (6.2831853071795862D * (double) phase)
                    / (double) frames);
            g.copyArea(0, i, w1, 1, (int) d, 0);
            if (borderGap) {
                g.setColor(color);
                g.drawLine((int) d, i, 0, i);
                g.drawLine((int) d + w1, i, w1, i);
            }
        }

    }

    private void shearY(Graphics g, int w1, int h1, Color color) {

        int period = random.nextInt(40) + 10;

        boolean borderGap = true;
        int frames = 20;
        int phase = 7;
        for (int i = 0; i < w1; i++) {
            double d = (double) (period >> 1)
                    * Math.sin((double) i / (double) period
                    + (6.2831853071795862D * (double) phase)
                    / (double) frames);
            g.copyArea(i, 0, 1, h1, 0, (int) d);
            if (borderGap) {
                g.setColor(color);
                g.drawLine(i, (int) d, i, 0);
                g.drawLine(i, (int) d + h1, i, h1);
            }

        }

    }

    public void write(OutputStream sos) throws IOException {
        ImageIO.write(buffImg, "png", sos);
        sos.close();
    }

    public BufferedImage getBuffImg() {
        return buffImg;
    }

    public String getCode() {
        return code.toLowerCase();
    }
}

 二、 控制层调用

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.UUID;
import java.util.concurrent.TimeUnit;

/**
 * @desc:图形验证码
 */
@RestController
@RequestMapping(value = "/code", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public class CaptchaCodeController {

    @Autowired
    private StringRedisTemplate redisTemplate;

	/**
	 * 下发验证码标识给客户端,客户端也可以自己生成
	 * @return
	 */
    @GetMapping(value = "/initCode")
    public String initCode(){
        try {
            //下发验证码标识
            String captchaId=UUID.randomUUID().toString().replace("-","");
            return captchaId;
        }catch (Exception e){
             throw new BusinessException("初始化验证码异常");
        }
    }

	/**
	 * 验证码以流的形式响应给客户端
	 * @param captchaId
	 * @param response
	 * @throws IOException
	 */
    @GetMapping(value = "/draw/{captchaId}")
    public  void  drawCaptcha(@PathVariable("captchaId") String captchaId, HttpServletResponse response) throws IOException {
        //生成4位随机验证码
        String code= new CaptchaCodeUtil().randomStr(4);
        //id和验证码存入redis,3分钟有效
        redisTemplate.opsForValue().set("CODE:"+captchaId,code,3l,TimeUnit.MINUTES);
        //指定验证码长宽
        CaptchaCodeUtil vCode = new CaptchaCodeUtil(116,36,4,10,code);
        vCode.write(response.getOutputStream());
    }

    @GetMapping(value = "/verify/{captchaId}")
    public  String  verifyCaptcha(@PathVariable("captchaId") String captchaId, @PathVariable("code") String code) throws IOException {
        
        String rcode = redisTemplate.opsForValue().get("CODE:"+captchaId);
        if (!code.equals(rcode)) {
        	throw new BusinessException("图片验证码错误");
		}
		return "SUCCESS";
        
    }

}

 

  • 6
    点赞
  • 14
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
<%@ page language="java" contentType="text/html; charset=gb2312" pageEncoding="gb2312"%> <%@ page import="java.io.*"%> <%@ page import="jxl.Workbook"%> <%@ page import="jxl.write.*"%> <%@ page import="javax.servlet.http.HttpServletRequest"%> <%@ page import="java.text.SimpleDateFormat"%> <%@ page import="java.util.Date"%> <%!static String getStringGBK(HttpServletRequest request, String name) throws Exception { String result = ""; if(request.getParameter(name) != null){ result = new String(request.getParameter(name).getBytes("iso-8859-1"),"gbk"); } return result; }%> <%!static String getStringGBK(String str) throws Exception { String result = new String(str.getBytes("iso-8859-1"), "gbk"); return result; }%> <% WritableWorkbook book = null; String path = ""; String dateString = ""; String msg = "调查报告已经提交成功。"; try { Date now = new Date(); dateString = new SimpleDateFormat("yyyyMMddHHmmss").format(now); //Excel获得文件 path = request.getRealPath("/"); Workbook wb = Workbook.getWorkbook(new File(path + "excel\\template.xls")); //打开一个文件的副本,并且指定数据写回到原文件 book = Workbook.createWorkbook(new File(path + "excel\\调查报告_" + dateString + ".xls"), wb); String txrq = getStringGBK(request, "txrq"); // 填写日期 String yycode = getStringGBK(request, "yycode"); // 医院组织机构代码 String yyname = getStringGBK(request, "yyname"); // 医院全称: String cldate_year = getStringGBK(request, "cldate_year"); // 成立日期: String cldate_month = getStringGBK(request, "cldate_month"); // 成立日期: String yydj = getStringGBK(request, "yydj"); // 医院级别: String yyxz = getStringGBK(request, "yyxz"); // 医院性质: String yyfl = getStringGBK(request, "yyfl"); // 医院分类: String yydz_sheng = getStringGBK(request, "yydz_sheng"); // 医院地址: String yydz_si = getStringGBK(request, "yydz_si"); // 医院地址: String yydz_quxian = getStringGBK(request, "yydz_quxian"); // 医院地址: String yydz_jie = getStringGBK(request, "yydz_jie"); // 医院地址: String yydz_hao = getStringGBK(request, "yydz_hao"); // 医院地址: String yzbm = getStringGBK(request, "yzbm"); // 邮 编 String zzxm = getStringGBK(request, "zzxm"); // 现任主任(或者联系人)姓名 String lxdh = getStringGBK(request, "lxdh"); // 联系电话 String sjhm = getStringGBK(request, "sjhm"); // 手机号码 String email = getStringGBK(request, "email"); // 手机号码 String clrq_year = getStringGBK(request, "clrq_year"); // 内分泌科(内科内分泌专业组)成立日期 String clrq_mon = getStringGBK(request, "clrq_mon"); // 内分泌科(内科内分泌专业组)成立日期 String szqk = getStringGBK(request, "szqk"); // 内分泌科室的设置情况 String nfmrs = getStringGBK(request, "nfmrs"); // 内分泌专业医生人数 String nfmcs = getStringGBK(request, "nfmcs"); // 内分泌科床位数 String rmzl = getStringGBK(request, "rmzl"); // 日门诊量 String nmzl = getStringGBK(request, "nmzl"); // 年门诊量 String nszrl = getStringGBK(request, "nszrl"); // 年收治病人量 String[] ysxx_names = request.getParameterValues("ysxx_name"); // 姓名 String[] ysxx_sexs = request.getParameterValues("ysxx_sex"); // 性别 String[] ysxx_nl_years = request.getParameterValues("ysxx_nl_year"); //出生年 String[] ysxx_nl_mons = request.getParameterValues("ysxx_nl_mon"); //出生月 String[] ysxx_zcs = request.getParameterValues("ysxx_zc"); //职称 String[] ysxx_xls = request.getParameterValues("ysxx_xl"); //学历 String[] ysxx_xws = request.getParameterValues("ysxx_xw"); //学位 String[] ysxx_byyxs = request.getParameterValues("ysxx_byyx"); //毕业院校 String[] ysxx_csnxs = request.getParameterValues("ysxx_csnx"); //从事专业年限 String[] ysxx_sjhms = request.getParameterValues("ysxx_sjhm"); //手机号码 String[] ysxx_emails = request.getParameterValues("ysxx_email"); //电子邮箱 String smzksy = getStringGBK(request, "smzksy"); //是否具有内分泌专科实验室 String[] tzwts = request.getParameterValues("tzwt"); // 目前内分泌科(专业组)发展所面临的挑战与问题 String[] bzzcs = request.getParameterValues("bzzc"); // 希望得到内分泌代谢医师分会提供哪些方面的帮助和支持 String cwhy = getStringGBK(request, "cwhy"); //是否愿意加入本分会成为会员: String[] gzjys = request.getParameterValues("gzjy"); // 您和您的单位对本分未来工作的建议 int rowInsertAmount = 0; int rowNoQuestion4 = 32; int rowNoQuestion6 = 39; int rowNoQuestion7 = 42; int rowNoQuestion9 = 51; //WritableFont font1 = new WritableFont(WritableFont.TIMES, 16, //WritableFont.BOLD); //或设置字体格式为excel支持的格式 WritableFont font3=new WritableFont(WritableFont.createFont("楷体_GB2312"),12,WritableFont.NO_BOLD ); //WritableCellFormat format1 = new WritableCellFormat(font1); WritableCellFormat format1 = new WritableCellFormat(); WritableCellFormat format2 = new WritableCellFormat(); format2.setBorder(jxl.format.Border.TOP,jxl.format.BorderLineStyle.THIN); format2.setBorder(jxl.format.Border.LEFT,jxl.format.BorderLineStyle.THIN); format2.setBorder(jxl.format.Border.RIGHT,jxl.format.BorderLineStyle.THIN); format2.setBorder(jxl.format.Border.BOTTOM,jxl.format.BorderLineStyle.THIN); //把水平对齐方式指定为居中 //format1.setAlignment(jxl.format.Alignment.CENTRE); //把垂直对齐方式指定为居中 //format1.setVerticalAlignment(jxl.format.VerticalAlignment.CENTRE); //设置自动换行 //format1.setWrap(true); //添加一个工作表 WritableSheet sheet = book.getSheet(0); sheet.addCell(new Label(2, 6, txrq, format1)); // sheet.addCell(new Label(11, 6, yycode, format1)); // sheet.addCell(new Label(2, 7, yyname, format1)); // sheet.addCell(new Label(10, 7, cldate_year, format1)); // sheet.addCell(new Label(13, 7, cldate_month, format1)); // sheet.addCell(new Label(2, 8, yydj, format1)); // sheet.addCell(new Label(7, 8, yyxz, format1)); // sheet.addCell(new Label(2, 9, yyfl, format1)); // sheet.addCell(new Label(2, 10, yydz_sheng, format1)); // /* sheet.addCell(new Label(7, 10, yydz_si, format1)); // sheet.addCell(new Label(11, 10, yydz_quxian, format1)); // sheet.addCell(new Label(2, 11, yydz_jie, format1)); // sheet.addCell(new Label(6, 11, yydz_hao, format1)); // */ sheet.addCell(new Label(2, 12, yzbm, format1)); // sheet.addCell(new Label(5, 14, zzxm, format1)); // sheet.addCell(new Label(12, 14, lxdh, format1)); // sheet.addCell(new Label(2, 15, sjhm, format1)); // sheet.addCell(new Label(12, 15, email, format1)); // sheet.addCell(new Label(7, 19, clrq_year, format1)); // sheet.addCell(new Label(11, 19, clrq_mon, format1)); // if (!"其他".equals(szqk)) { sheet.addCell(new Label(1, 22, szqk, format1)); // } else { String szqk_qtnr = new String(request.getParameter( "szqk_qtnr").getBytes("iso-8859-1"), "gbk"); // 内分泌科室的设置情况 其它 sheet.addCell(new Label(1, 22, szqk + ":" + szqk_qtnr, format1)); // } sheet.addCell(new Label(4, 25, nfmrs, format1)); // sheet.addCell(new Label(11, 25, nfmcs, format1)); // sheet.addCell(new Label(2, 26, rmzl, format1)); // sheet.addCell(new Label(6, 26, nmzl, format1)); // sheet.addCell(new Label(12, 26, nszrl, format1)); // //4. 医生信息登记 int index0 = 1; for (int i = 0; i < ysxx_names.length; i++) { if("".equals(getStringGBK(ysxx_names[i]))){ continue; } if (index0 > 1) { // 插入一行 sheet.insertRow(rowNoQuestion4); sheet.mergeCells(4, rowNoQuestion4, 5, rowNoQuestion4 ); sheet.mergeCells(6, rowNoQuestion4, 7, rowNoQuestion4 ); sheet.mergeCells(9, rowNoQuestion4, 10, rowNoQuestion4 ); sheet.mergeCells(11, rowNoQuestion4, 12, rowNoQuestion4 ); sheet.mergeCells(13, rowNoQuestion4, 14, rowNoQuestion4 ); sheet.mergeCells(15, rowNoQuestion4, 16, rowNoQuestion4 ); rowNoQuestion4++; rowInsertAmount++; } sheet.addCell(new Label(1, 30 + rowInsertAmount, getStringGBK(ysxx_names[i]) , format2)); // sheet.addCell(new Label(2, 30 + rowInsertAmount, getStringGBK(ysxx_sexs[i]) , format2)); // sheet.addCell(new Label(3, 30 + rowInsertAmount, getStringGBK(ysxx_nl_years[i]) + "/" + getStringGBK(ysxx_nl_mons[i]), format2)); //出生年月 sheet.addCell(new Label(4, 30 + rowInsertAmount, getStringGBK(ysxx_zcs[i]) , format2)); // sheet.addCell(new Label(6, 30 + rowInsertAmount, getStringGBK(ysxx_xls[i]) , format2)); // sheet.addCell(new Label(8, 30 + rowInsertAmount, getStringGBK(ysxx_xws[i]) , format2)); // sheet.addCell(new Label(9, 30 + rowInsertAmount, getStringGBK(ysxx_byyxs[i]) , format2)); // sheet.addCell(new Label(11, 30 + rowInsertAmount, getStringGBK(ysxx_csnxs[i]) , format2)); // sheet.addCell(new Label(13, 30 + rowInsertAmount, getStringGBK(ysxx_sjhms[i]) , format2)); // sheet.addCell(new Label(15, 30 + rowInsertAmount, getStringGBK(ysxx_emails[i]) , format2)); // index0++; } //5.是否具有内分泌专科实验室: sheet.addCell(new Label(5, 32 + rowInsertAmount, smzksy, format1)); // if("是".equals(smzksy)) { String smzksy_gzrs = getStringGBK(request, "smzksy_gzrs"); //实验室工作人员人数 String smzksy_sbjz = getStringGBK(request, "smzksy_sbjz"); //实验室设备价值 String smzksy_rbbl = getStringGBK(request, "smzksy_rbbl"); //实验室日处理标本量 String smzksy_ysl = getStringGBK(request, "smzksy_ysl"); //实验室月收入 sheet.addCell(new Label(4, 33 + rowInsertAmount, smzksy_gzrs, format1)); // sheet.addCell(new Label(11, 33 + rowInsertAmount, smzksy_sbjz, format1)); // sheet.addCell(new Label(4, 34 + rowInsertAmount, smzksy_rbbl, format1)); // sheet.addCell(new Label(11, 34 + rowInsertAmount, smzksy_ysl, format1)); // } //6.目前内分泌科(专业组)发展所面临的挑战与问题 int index1 = 1; rowNoQuestion6 = rowNoQuestion6 + rowInsertAmount; for (int i = 0; i < tzwts.length; i++) { if("".equals(getStringGBK(tzwts[i]))){ continue; } if (index1 > 1) { // 插入一行 sheet.insertRow(rowNoQuestion6); rowNoQuestion6++; rowInsertAmount++; } sheet.addCell(new Label(1, 37 + rowInsertAmount, index1++ + ". " + getStringGBK(tzwts[i]) , format1)); // } //7.希望得到内分泌代谢医师分会提供哪些方面的帮助和支持(可多选) rowNoQuestion7 = rowNoQuestion7 + rowInsertAmount; for (int i = 0; i < bzzcs.length; i++) { if (i > 0) { // 插入一行 sheet.insertRow(rowNoQuestion7); rowNoQuestion7++; rowInsertAmount++; } if(!"其他(请填写):".equals(getStringGBK(bzzcs[i]))){ sheet.addCell(new Label(1, 40 + rowInsertAmount, getStringGBK(bzzcs[i]) , format1)); // } else { String bzzc_qt = getStringGBK(request, "bzzc_qt"); //其他(请填写) sheet.addCell(new Label(1, 40 + rowInsertAmount, getStringGBK(bzzcs[i]) + bzzc_qt, format1)); // } } // 8.是否愿意加入本分会成为会员: sheet.addCell(new Label(6, 42 + rowInsertAmount, cwhy, format1)); // if("是".equals(cwhy)) { String cwhy_hf = getStringGBK(request, "cwhy_hf"); //您认为会员每年会费多少合适 String cwhy_hybl = getStringGBK(request, "cwhy_hybl"); //分会评选年度优秀内分泌代谢科医师,您认为占会员的比例多少合适 sheet.addCell(new Label(1, 44 + rowInsertAmount, cwhy_hf, format1)); // sheet.addCell(new Label(1, 46 + rowInsertAmount, cwhy_hybl, format1)); // } //9.您和您的单位对本分未来工作的建议 int index2 = 1; rowNoQuestion9 = rowNoQuestion9 + rowInsertAmount; for (int i = 0; i < gzjys.length; i++) { if("".equals(getStringGBK(gzjys[i]))){ continue; } if (index2 > 1) { // 插入一行 sheet.insertRow(rowNoQuestion9); rowNoQuestion9++; rowInsertAmount++; } sheet.addCell(new Label(1, 49 + rowInsertAmount, index2++ + ". " + getStringGBK(gzjys[i]) , format1)); // } } catch (Exception e) { System.out.println(path + "excel\\调查报告_" + dateString + ".xls : " + e); e.printStackTrace(); msg = "调查报告提交失败,请重新提交或者联系管理员。"; } finally { book.write(); book.close(); } %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> <title>中国医师协会内分泌代谢科医师分会调查问卷</title> <script type="text/javascript"> function closeWindow() { window.open('','_parent',''); window.close(); } </script> </head> <body style="background-color:#E0ECF9"> <table border="0" align="center"> <tr> <td width="180" align="left"><img src="img/CEA-logo.gif" style=""/></td> <td width="550"><div align="left" style="font-size:25px"><strong>中国医师协会内分泌代谢科医师分会</strong></div></td> </tr> <tr> <td height="30"></td> </tr> <tr> <td colspan="2"> <div align="center"><strong><%= msg %></strong></div> </td> </tr> <tr> <td height="10"></td> </tr> <tr> <td colspan="2"> <div align="center"> <input type="button" onclick="closeWindow();" value="关 闭"/> </div> </td> </tr> </table> </body> </html>

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值