Well I tried a slightly different approach and attempted to implement the
reCaptcha web service. This worked fine in my Spring prototype whereby I merely
added the sample Javascript below to my form and then read it's
request/response parameters in my Spring MVC Controller.
However, when I tried to implement reCapthca using Click, I am unable to pass
any values back to my Page class. Both of these parameters return null:
String challenge =
getContext().getRequest().getParameter("recaptcha_challenge_field");
String response =
getContext().getRequest().getParameter("recaptcha_response_field");
I guess it makes sense as I only have one parameter on my HTM page, namely
$form. Since the WebService reCaptcha sript lies"outside" or below the $form on
my page, I wonder, then if it is even possible to embed a Javascript element
inside a form using Click? Otherwise, how else could you pass back any
arguments to the Page class?
Source: http://wheelersoftware.com/articles/recaptcha-java.html
<script type="text/javascript"
src="http://api.recaptcha.net/challenge?k=<your_public_key>">
</script>
<noscript>
<iframe src="http://api.recaptcha.net/noscript?k=<your_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>
Thanks again,
Conor
----- Original Message ----
From: Bob Schellink <[email protected]>
To: [email protected]
Sent: Sat, April 3, 2010 2:24:04 AM
Subject: Re: Does Apache Click support Captchas?
Hi Conor,
Depends on the markup you need to render for the Captcha service to work.
Although I haven't
incorporated a Captcha myself I'd imagine you'll need to create a custom Field
that renders the
HTML/JavaScript expected by the captcha service.
kind regards
bob
On 3/04/2010 9:08 AM, C Jennings wrote:
> Hi -
> Just curious if Apache Click was be integrated with a Captcha Generation
> Service? I've done this recently using a Spring Framework with JCaptcha.
> However, that approach required the use of a Spring MVC Controller which is
> not supported with the Click framework.
>
> If anyone has had an success with implementing a Captcha service with a Click
> framework, I'd appeciate it if you could share some pointers.
>
> Many thanks
>
> Conor
>
>
>
>