2011-02-23 42 views
0

任何驗證碼插件支柱2比jcaptcha4struts2等,並提供了一些有用的鏈接也驗證碼插件支柱2

+0

如果您發現任何Java驗證碼解決方案,它應該不太難用S2來實現,我只是說你不必限制自己插件。驗證碼有什麼要求? – Quaternion 2011-02-23 22:27:51

+0

驗證碼圖片必須刷新使用刷新按鈕 – 2011-02-24 04:09:11

+0

這只是一個JS。我個人發現這個有用,它異步加載貓的圖片http://api.jquery.com/jQuery.getJSON/ – Quaternion 2011-02-24 20:48:50

回答

2

試試這個: http://code.google.com/intl/de-DE/apis/recaptcha/docs/java.html

它與Struts的2

我建議非常簡單您複製源代碼(其ASL許可並因此允許),然後按照說明進行操作。或者你創建一個taglib,如果你想避免你的jsp中的java代碼。

服務器端指令可以修改爲與字段名稱recaptcha_challenge_field和recaptcha_response_field一起使用。

如果添加下面的方法到你的動作:

public HttpServletRequest getHttpServletRequest() { 
    return httpServletRequest; 
} 

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

而下面的監聽器添加到web.xml中:

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

你是能夠趕上的HttpServletRequest這是必要的驗證驗證碼。

希望有所幫助。 乾杯, 基督教