1

我使用 jQuery(一个语法高亮脚本库)编写了一个 jsf2 (cdi) Web 应用程序。在一页上,我使用的是 primefaces 3.2 p:captcha 组件。

这是使用验证码组件的片段。

          <p>
                <p:captcha
                    id="commentCaptcha"
                    theme="white"
                    required="true"
                    requiredMessage="Bitte geben Sie die angezeigten Zeichen im Captcha Dialog ein."                        
                    validatorMessage="Die Captcha Prüfung ist fehlgeschlagen. Bitte versuchen Sie es erneut."
                    secure="true"
                    language="de"/>
            </p>  
            <p>
                <h:commandButton
                    action="#{commentCreatorBean.createCommentForArticle(newComment, article)}" 
                    value="Eintragen">
                    <f:ajax 
                        execute="commentCaptcha name mail comment" 
                        render=":commentsGroup @form :commentMessages"/>                        
                </h:commandButton>
                <div id="hint">...</div>
            </p> 
  • 如果验证码对话框中的给定输入是正确的,那么一切正常,在这种情况下,注释会被保留。
  • 给定的输入是否为空,而不是在 h:messages 区域中显示 requiredMessage 并且弹出显示错误消息(请参阅下面的错误消息)
  • 给定的输入是否错误,validatorMessage 显示在 h:messages 区域中,并且弹出显示错误消息(请参阅下面的错误消息)

如果使用 chromium 浏览器,我收到错误消息:malformedXML: NETWORK_ERR: XMLHttpRequest Exception 101 如果使用 firefox 浏览器,我收到:malformedXML: Component returned failure code: 0x80004005 (NS_ERROR_FAILURE)

有谁知道,问题是什么?我在 google 的 recaptcha 页面上注册了我的域。公钥和私钥在 web.xml 中设置(遵循 primefaces 文档的说明)

提前致谢!

4

1 回答 1

0

您似乎正在尝试通过 AJAX 提交 Primefaces 验证码。

这行不通。

Primefaces Captcha 是 Recaptcha 插件的扩展,目前不支持 AJAX 功能。

于 2012-05-11T19:21:58.843 回答