It's not a secret anymore!*
The moose likes Spring and the fly likes reCaptcha issue with Spring MVC Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Spring
Bookmark "reCaptcha issue with Spring MVC" Watch "reCaptcha issue with Spring MVC" New topic
Author

reCaptcha issue with Spring MVC

Rohit Bhal
Ranch Hand

Joined: Aug 28, 2007
Posts: 44
Hi

I've been trying to integrate reCaptcha with my application built on Spring framework, but I am getting this error:


Could someone help me understand that why am I getting this error. I've got both "recaptcha_challenge_field" and "recaptcha_response_field" parameters bound to the User domain object.

Could anybody help me understand what am I missing?

Thanks


Skip Skipping
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17249
    
    6

Just a wild guess, but it doesn't look like the value that was entered in the field is in the request parameter list.

Are you sure it is within your form tags?

Mark


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
Rohit Bhal
Ranch Hand

Joined: Aug 28, 2007
Posts: 44
Hi Mark, that was exactly what I thought first and tried the crude way to having the <script> and <noscript> tags in the jsp with public key and tried working it out but it dint help either.

Here is the code of the controller I am using, all I am trying to do is register a user with reCaptcha functionality but what I am getting is a http status 400 with the error :

UserManagementController.java


Here is the addNewUser.jsp element on the form page for the above controller:



I wonder what am I missing here?
Thanks for reply.

Rohit Bhal
Ranch Hand

Joined: Aug 28, 2007
Posts: 44
I removed the and and tried and , what I found was that I was getting null value for both recaptcha_response_field and recaptcha_response_field.
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17249
    
    6

@RequestParam("recaptcha_challenge_field")

would mean that the url has recaptcha_challenge_field as a request parameter like

www.mysite.com/myApp//addNewUser.do?recaptcha_challenge_field=someValueHere

Have you checked inside your Model model parameter in that method. What does it have in it?

Mark

Rohit Bhal
Ranch Hand

Joined: Aug 28, 2007
Posts: 44
Hi Mark, thanks for reply again.
request.getParameter('..')[http status 500, with null value for challenge and response fields], request.getAttribute('..')[http status 500, with null value for challenge and response fields] and @RequestParam('..')[http status 400].
I ran it under debug mode to see what was inside the 'Model model' and have taken 2 screen shots in case you find them useful.
Here are the links for them:
model
user inside model

I had reCaptcha working with Spring 2.5 from the book 'Spring in Practice' sometime ago, I wonder what am I missing with Spring 3. I have started feeling depressed now

Thanks for reply
Rohit Bhal
Ranch Hand

Joined: Aug 28, 2007
Posts: 44
I've got jCaptcha working but I am still missing reCaptcha

Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17249
    
    6

Deshraj Kiran wrote:I've got jCaptcha working but I am still missing reCaptcha



So what did you do for that one?

Mark
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17249
    
    6

Deshraj Kiran wrote:Hi Mark, thanks for reply again.
request.getParameter('..')[http status 500, with null value for challenge and response fields], request.getAttribute('..')[http status 500, with null value for challenge and response fields] and @RequestParam('..')[http status 400].
I ran it under debug mode to see what was inside the 'Model model' and have taken 2 screen shots in case you find them useful.
Here are the links for them:
model
user inside model

I had reCaptcha working with Spring 2.5 from the book 'Spring in Practice' sometime ago, I wonder what am I missing with Spring 3. I have started feeling depressed now

Thanks for reply


What is the other entry in the Model map? You had one which is the User object, but what is the other entry?

Mark
Rohit Bhal
Ranch Hand

Joined: Aug 28, 2007
Posts: 44
Hi Mark, to get jCaptcha working I just needed a Controller and a bean configured in the application context configuration file to get the image displayed. And then some validation to check is the response entered by user was correct.

This is a piece from the addNewUser.jsp:



For some reasons attribute inside the img tag is not being displayed, its just src="captcha.do".
The other object inside Model model is org.springframework.validation.BindingResult.user.
model.toString() gave me:

Thanks again for reply

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: reCaptcha issue with Spring MVC
 
Similar Threads
Spring security: pass additional parameter when performing login
Spring Security 3 Namespace Configuration Gotcha
Problem in creating simple entity bean/WSAD
Spring Security 3: @PostFilter not working
Help with rack-Recaptcha