java验证码

<servlet>
    <servlet-name>checkcode</servlet-name>
    <servlet-class>com.ect.servlet.CheckCodeServlet</servlet-class>
  </servlet>
	<servlet-mapping>
    <servlet-name>checkcode</servlet-name>
    <url-pattern>/checkcode</url-pattern>
  </servlet-mapping>
  
  <servlet>
    <servlet-name>check</servlet-name>
    <servlet-class>com.ect.servlet.CheckServlet</servlet-class>
  </servlet>
	<servlet-mapping>
    <servlet-name>check</servlet-name>
    <url-pattern>/check</url-pattern>
  </servlet-mapping>

<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <title>验证码</title>
    <script type="text/javascript">
    function refresh(obj) {
        obj.src = "checkcode?"+Math.random();
    }
    </script>
  </head>
  <body>
    <form action="check" method="post">
        <label>输入验证码</label><br/>
        <input type="text" name="randomCode"/><img title="点击更换" onclick="javascript:refresh(this);" src="checkcode"><br/>
        <input type="submit" value="submit">
    </form>
  </body>
</html>

你可能感兴趣的:(java java验证码)