首页>代码>java随机动态生成汉字验证码图片的实例代码分享>/captchaZh/src/com/zuidaima/service/ResultServlet.java
package com.zuidaima.service;
import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class ResultServlet extends HttpServlet {

	private static final long serialVersionUID = 1L;

	public void doGet(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {

		doPost(request, response);
	}

	public void doPost(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {

		response.setContentType("text/html;charset=utf-8");
		String validateC = (String) request.getSession().getAttribute("checkcode");
		String veryCode = request.getParameter("c");
		PrintWriter out = response.getWriter();
		if (veryCode == null || "".equals(veryCode)) {
			out.println("请输入验证码!");
		} else {
			if (validateC.equals(veryCode)) {
				out.println(1);
			} else {
				out.println("验证码输入错误!");
			}
		}
		out.flush();
		out.close();
	}

}
最近下载更多
minoford  LV8 2020年3月7日
inyoueyes  LV6 2019年4月3日
chao123  LV8 2019年3月12日
在线不是本人  LV12 2018年12月18日
My屌屌  LV9 2018年7月9日
白马程序员  LV4 2018年6月23日
zzz111958  LV1 2018年6月11日
FouYon9  LV2 2018年5月23日
做你的英雄  LV14 2018年5月14日
ycbsky  LV9 2018年4月29日
最近浏览更多
张张张飞  LV1 2023年11月28日
EFWAGGFAWGR 2023年10月19日
暂无贡献等级
微信网友_6499216006828032  LV1 2023年10月12日
heqian  LV16 2023年1月10日
dxn111 2022年11月28日
暂无贡献等级
dayuln  LV8 2022年4月27日
nbzhou2013  LV14 2022年3月17日
17798830  LV14 2022年1月25日
zhaoxu123123  LV10 2021年9月9日
newbag  LV9 2021年8月9日
顶部 客服 微信二维码 底部
>扫描二维码关注最代码为好友扫描二维码关注最代码为好友