我似乎在使用 Adobe 的 CQ5 开发的页面上实施 reCaptcha 测试时遇到问题。
我设置了一个 reCaptcha 组件,其中包含 2 个 .jsp 文件,一个用于显示验证码表单,另一个用于验证。
这是他们的样子
reCaptcha.jsp:
`
<%@include file="/libs/foundation/global.jsp"%>
<%
%>
<%@ page import="net.tanesha.recaptcha.ReCaptcha"%>
<%@ page import="net.tanesha.recaptcha.ReCaptchaFactory"%>
<html>
<body>
<form action="reCaptchaValidation.POST.jsp" method="post"><script
type="text/javascript"
src="http://www.google.com/recaptcha/api/challenge?k=public_key">
</script>
<noscript><iframe
src="http://www.google.com/recaptcha/api/noscript?k=public key"
height="300" width="500" frameborder="0"></iframe><br>
<textarea name="recaptcha_challenge_field" rows="3" cols="40">
</textarea> <input type="hidden" name="recaptcha_response_field"
value="manual_challenge"></noscript>
</body>
</html>
`
这是我的验证文件 reCaptcha.POST.jsp
<%@include file="/libs/foundation/global.jsp"%>
<%
%>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<%@ page import="net.tanesha.recaptcha.ReCaptchaImpl"%>
<%@ page import="net.tanesha.recaptcha.ReCaptchaResponse"%>
<html>
<body>
<%
String remoteAddr = request.getRemoteAddr();
ReCaptchaImpl reCaptcha = new ReCaptchaImpl();
reCaptcha.setPrivateKey("PRIVATE_KEY");
String challenge = request.getParameter("recaptcha_challenge_field");
String uresponse = request.getParameter("recaptcha_response_field");
ReCaptchaResponse reCaptchaResponse = reCaptcha.checkAnswer(remoteAddr, challenge, uresponse);
if (reCaptchaResponse.isValid()) {
out.print("is good");
} else {
out.print("is bad");
}
%>
</body>
</html>
当我包含该组件时,reCaptcha 表单显示得很好。但是,当我在字段中输入值并点击返回提交时,浏览器会抛出如下错误:
Status
500
Message
javax.jcr.nodetype.ConstraintViolationException: no matching property definition found for {}recaptcha_challenge_field
Location invalid link: /content/Main/reCaptchaValidation.POST.jsp/content/Main/reCaptchaValidation.POST.jsp
Parent Location /content/Main
Path
/content/Main/reCaptchaValidation.POST.jsp
Referer http://localhost:4502/content/Main/Flash.html
ChangeLog
<pre></pre>
我怀疑问题出在我处理电话后的方式上,但我不知道到底出了什么问题,因此不知道如何解决这个问题。
对此的任何指示将不胜感激..在此先感谢:)