Skip to content

Instantly share code, notes, and snippets.

@wdfx100
Created April 17, 2013 09:55
Show Gist options
  • Save wdfx100/5403133 to your computer and use it in GitHub Desktop.
Save wdfx100/5403133 to your computer and use it in GitHub Desktop.
#验证码#
jar:3
jcaptcha-2.0-alpha-1-SNAPSHOT.jar
jcaptcha-api-1.0.jar
jcaptcha-integration-simple-servlet-2.0-alpha-1-SNAPSHOT.jar
<form action="pay2" method="post">
<input type="hidden" name="token" value="${requestScope.request_token }"/>
输入支付金额:<input type="text" name="money"/><br>
请输入验证码:<input type="text" name="code" value=""/><br/>
<img alt="验证码" src="/jcaptcha.jpg" id="img">
<a href="javascript:;" id="showCode">看不清</a><br>
<input type="submit" value="支付">
</form>
<script type="text/javascript" src="/static/js/jquery-1.9.1.min.js"></script>
<script type="text/javascript">
$(function(){
$("#showCode").click(function(){
$("#img").attr("src","/jcaptcha.jpg?xx="+new Date().getTime());
});
});
</script>
<servlet>
<servlet-name>jcaptcha</servlet-name>
<servlet-class>com.octo.captcha.module.servlet.image.SimpleImageCaptchaServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>jcaptcha</servlet-name>
<url-pattern>/jcaptcha.jpg</url-pattern>
</servlet-mapping>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment