Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7707079
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T00:16:13+00:00 2026-06-01T00:16:13+00:00

Can I use recaptcha with apache wicket 1.5.3? Is there some good example?

  • 0

Can I use recaptcha with apache wicket 1.5.3? Is there some good example?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T00:16:15+00:00Added an answer on June 1, 2026 at 12:16 am

    Have you read this?

    I have added the guide here in case page disappears.

    Usage

    We will create a panel called RecaptchaPanel. In order to use this component to your application all you’ll have to do is this:

    add(new RecaptchaPanel("recaptcha"));
    

    and of course, add the component in your markup:

    <div wicket:id="recaptcha"></div>
    

    Implementation

    Implementation is simple. All you have to do, is to follow several steps:

    Add recaptcha dependency to your project

    <dependency>
     <groupid>net.tanesha.recaptcha4j</groupid>
     <artifactid>recaptcha4j</artifactid>
     <version>0.0.7</version>
    </dependency>
    

    This library hides the implementation details and expose an API for dealing with recaptcha service.

    Create associated markup (RecaptchaPanel.html)

    <wicket:panel><div wicket:id="captcha"></div></wicket:panel>
    

    Create RecaptchaPanel.java

    import net.tanesha.recaptcha.ReCaptcha;
    import net.tanesha.recaptcha.ReCaptchaFactory;
    import net.tanesha.recaptcha.ReCaptchaImpl;
    import net.tanesha.recaptcha.ReCaptchaResponse;
    
    /**
     * Displays recaptcha widget. It is configured using a pair of public/private keys which can be registered at the
     * following location:
     * 
    * https://www.google.com/recaptcha/admin/create
     * <br>
     * More details about recaptcha API: http://code.google.com/apis/recaptcha/intro.html
     *
     * @author Alex Objelean
     */
    @SuppressWarnings("serial")
    public class RecaptchaPanel extends Panel {
      private static final Logger LOG = LoggerFactory.getLogger(RecaptchaPanel.class);
      @SpringBean
      private ServiceProvider serviceProvider;
    
    
      public RecaptchaPanel(final String id) {
        super(id);
        final ReCaptcha recaptcha = ReCaptchaFactory.newReCaptcha(serviceProvider.getSettings().getRecaptchaPublicKey(),
          serviceProvider.getSettings().getRecaptchaPrivateKey(), false);
        add(new FormComponent<void>("captcha") {
          @Override
          protected void onComponentTagBody(final MarkupStream markupStream, final ComponentTag openTag) {
            replaceComponentTagBody(markupStream, openTag, recaptcha.createRecaptchaHtml(null, null));
          }
    
          @Override
          public void validate() {
            final WebRequest request = (WebRequest)RequestCycle.get().getRequest();
    
            final String remoteAddr = request.getHttpServletRequest().getRemoteAddr();
            final ReCaptchaImpl reCaptcha = new ReCaptchaImpl();
            reCaptcha.setPrivateKey(serviceProvider.getSettings().getRecaptchaPrivateKey());
    
            final String challenge = request.getParameter("recaptcha_challenge_field");
            final String uresponse = request.getParameter("recaptcha_response_field");
            final ReCaptchaResponse reCaptchaResponse = reCaptcha.checkAnswer(remoteAddr, challenge, uresponse);
    
            if (!reCaptchaResponse.isValid()) {
              LOG.debug("wrong captcha");
              error("Invalid captcha!");
            }
          }
        });
      }
    }
    </void>
    

    Things to notice:

    • ServiceProvider – is a spring bean containing reCaptcha configurations (public key and private key). These keys are different depending on the domain where your application is deployed (by default works for any key when using localhost domain). You can generate keys here: https://www.google.com/recaptcha/admin/create
    • The RecaptchaPanel contains a FormComponent, which allows implementing validate method, containing the validation logic.
    • Because reCaptcha use hardcoded values for hidden fields, this component cannot have multiple independent instances on the same page.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to use the recaptcha with CodeIgniter. I followed some online instructions and
i can use this code to remove click event, $('p').unbind('click') but , has some
My UsersControllerTest currently fails because I use verify_recaptcha in UsersController#create. How can I write
You can use more than one css class in an HTML tag in current
You can use a standard dot notation or a method call in Objective-C to
I can use properties of an Excel Worksheet to tell if the worksheet is
You can use ftplib for full FTP support in Python. However the preferred way
You can use SelectFolder() to get a folder or GetOpenFolderitem(filter as string) to get
You can use App.config; but it only supports key/value pairs. You can use .Net
I can use VS08's MFC/ActiveX template to create a C++ ActiveX object that I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.