• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

reCaptcha issue with Spring MVC

 
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Rohit Bhal
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 44
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
@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
Posts: 44
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 44
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I've got jCaptcha working but I am still missing reCaptcha

 
Mark Spritzler
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
Posts: 44
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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:)

 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic