servlets - captcha error on jsp -
i have captcha on jsp form , response enter in wrong condition never enter in wright 1
here jsp code:
<%@ page import="net.tanesha.recaptcha.recaptcha" %> <%@ page import="net.tanesha.recaptcha.recaptchafactory" %> <form action="captchaverif" method="post" class="register modalreg" role="form"> <!-- captcha --> <div class="g-recaptcha" data- sitekey="6lcxqb8taaaaann08bywsrspvqjh_5feqpnxshin"></div> <!-- captcha --> <button value="reg" type="submit" class="btn btn-primary btn-lg-btn-block">s'inscrire</button> </form>
and here servlet :
string remoteaddr = request.getremoteaddr(); recaptchaimpl recaptcha = new recaptchaimpl(); recaptcha.setprivatekey("6lcxqb8taaaaakkxkr4uwte--l1vwgmqkwgf6mga"); string challenge = request.getparameter("recaptcha_challenge_field"); string uresponse = request.getparameter("recaptcha_response_field"); recaptcharesponse recaptcharesponse = recaptcha.checkanswer(remoteaddr, challenge, uresponse); if (recaptcharesponse.isvalid()) { response.sendredirect("inscription.jsp"); //doesn't enter here } if (!recaptcharesponse.isvalid()){ processrequest(request, response); //always enter here }
i can't find error ?
Comments
Post a Comment