开发者

captcha plugin for struts 2

Any captcha plugin for struts 2 other than jcaptcha4struts2 and provide some useful开发者_运维问答 link also


Try this: http://code.google.com/intl/de-DE/apis/recaptcha/docs/java.html

It is pretty straightforward with Struts 2.

I recommend you to copy over the source code (its ASL licensed and therefore allowed) and then follow the instructions. Or you create a taglib, if you would like to avoid java code in you jsp.

The server side instructions can be modified to use it with the field names recaptcha_challenge_field and recaptcha_response_field.

If you add the following methods to your action:

public HttpServletRequest getHttpServletRequest() {
    return httpServletRequest;
}

public void setHttpServletRequest(HttpServletRequest httpServletRequest) {
    this.httpServletRequest = httpServletRequest;
}

And add the following listener to web.xml:

 <listener>
    <listener-class>org.springframework.web.context.request.RequestContextListener</listener-class>
</listener>

You are able to catch the HttpServletRequest which is necessary to validate the captcha.

Hope that helps. Cheers, Christian

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜