谷歌reCaptcha在JSF响应g-recaptcha-response null

时间:2015-07-25 05:09:38

标签: jsf jsf-2 httprequest recaptcha

我正在尝试在我的jsf项目中使用Google ReCaptcha 我已经成功地渲染了这样的gui:

<h:form id="contact-form" class="contact-form">   
    <p:panelGrid styleClass="submitGrid" columns="2">
         <div class="g-recaptcha" data-theme="dark" data-sitekey="my-site-Key"></div>
            <p class="contact-submit">
               <p:commandButton id="contact-submit" styleClass="submit" value="Send" action="#{questionaryBean.validation()}" update="contact-submit,confirmDlg, contact-form" oncomplete="PF('dlg').show()"/>
            </p>
    </p:panelGrid>
</h:form>

这是我的支持豆:

public void save(){
    Map<String,String> requestParams = FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap();
  requestParams.get("reportKey");
  for(String key:requestParams.keySet()){
      System.out.println("key:"+key+" value:"+requestParams.get(key));
  }
}

如您所见,我打印了所有请求参数,但我在这里看不到g-recaptcha-response。当然,如果我使用String gRecaptchaResponse=requestParams.get("g-recaptcha-response");,则字符串gRecaptchaResponse为空 我做错了吗?

0 个答案:

没有答案