Created
February 17, 2013 18:21
-
-
Save madan712/4972642 to your computer and use it in GitHub Desktop.
JSP example - Google Recaptcha validation using jquery (AJAX)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<%@ page import="net.tanesha.recaptcha.ReCaptchaImpl,net.tanesha.recaptcha.ReCaptchaResponse" %><% | |
ReCaptchaImpl reCaptcha = new ReCaptchaImpl(); | |
reCaptcha.setPrivateKey("your_private_key"); | |
String remoteip = request.getParameter("remoteip"); | |
String challenge = request.getParameter("challenge"); | |
String res = request.getParameter("response"); | |
ReCaptchaResponse reCaptchaResponse = reCaptcha.checkAnswer(remoteip, challenge, res); | |
if (reCaptchaResponse.isValid()) { | |
out.print("true"); | |
} else { | |
out.print("false"); | |
} | |
%> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment