JSF2.0 + Primefaces 3.0.1 + jquery 1.6.4 + p:commandLink + IE8抛出对方法或属性的意外调用 [英] JSF2.0 + Primefaces 3.0.1 + jquery 1.6.4 + p:commandLink + IE8 throws Unexpected call to method or property

查看:91
本文介绍了JSF2.0 + Primefaces 3.0.1 + jquery 1.6.4 + p:commandLink + IE8抛出对方法或属性的意外调用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

团队,

我正在基于maven的jetty(8.0.1)上运行所描述的设置,并在IE8中获得一些奇怪的例外(仅限!)。

i am running the described setup on a maven based jetty (8.0.1) and get some strange exceptions in IE8 (only!).

IE给我的错误,如下所示:

The Error that IE is given me, looks like:

Webpage error details

User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0)
Timestamp: Wed, 29 Feb 2012 14:09:38 UTC

Message: Unexpected call to method or property access.
Line: 23
Char: 22640
Code: 0
URI: http://127.0.0.1:8080/javax.faces.resource/jquery/jquery.js.jsf?ln=primefaces&v=3.0.1

'javax.faces中描述的一段代码。在第23行,资源/ jquery / jquery.js.jsf?ln = primefaces& v = 3.0.1',char 22640是'finally'之后的'{':

The described piece of code in 'javax.faces.resource/jquery/jquery.js.jsf?ln=primefaces&v=3.0.1' on line 23, char 22640 is the '{' after the 'finally':

resolveWith:function(bw,bv){
   if(!bs&&!bu&&!br){
      bv=bv||[];
      br=1;
      try{
         while(bt[0]){
            bt.shift().apply(bw,bv)
         }
      }finally{
         bu=[bw,bv];
         br=0
      }
   }
   return this
}

这里JSF XHTML重现此错误:

Here the JSF XHTML to reproduce this error:

<html xmlns="http://www.w3.org/1999/xhtml"
   xmlns:c="http://java.sun.com/jstl/core"
   xmlns:f="http://java.sun.com/jsf/core"
   xmlns:h="http://java.sun.com/jsf/html"
   xmlns:ui="http://java.sun.com/jsf/facelets"
   xmlns:p="http://primefaces.org/ui">
<f:view contentType="text/html">
   <h:head>
   </h:head>
   <h:body>
      <h:form>
         <h:form>
            <p:dialog id="testDialog" header="Test Dialog" modal="true"
               widgetVar="testDialog" dynamic="true" resizable="true"
               maximizable="true" showEffect="fade" hideEffect="explode">
               <h:outputText value="Dialog!" />
            </p:dialog>
            <p:commandLink styleClass="button" oncomplete="testDialog.show()">
               <h:outputText value="Click me!" />
            </p:commandLink>
         </h:form>
      </h:form>
   </h:body>
</f:view>
</html>

以下JSF XHTML没有抛出错误:

The following JSF XHTML is not throwing the error:

<html xmlns="http://www.w3.org/1999/xhtml"
   xmlns:c="http://java.sun.com/jstl/core"
   xmlns:f="http://java.sun.com/jsf/core"
   xmlns:h="http://java.sun.com/jsf/html"
   xmlns:ui="http://java.sun.com/jsf/facelets"
   xmlns:p="http://primefaces.org/ui">
<f:view contentType="text/html">
   <h:head>
   </h:head>
   <h:body>
      <h:form>
         <p:dialog id="testDialog" header="Test Dialog" modal="true"
            widgetVar="testDialog" dynamic="true" resizable="true"
            maximizable="true" showEffect="fade" hideEffect="explode">
            <h:outputText value="Dialog!" />
         </p:dialog>
         <p:commandLink styleClass="button" oncomplete="testDialog.show()">
            <h:outputText value="Click me!" />
         </p:commandLink>
      </h:form>
   </h:body>
</f:view>
</html>

不同之处在于第一个示例中的嵌套表单。这是非常理想化的示例,但如果我嵌套组件和对话框,则反映相同的行为。无论何时嵌套表单,IE8中都会出现上述错误。 FF和其他人只是按预期打开对话框。

The difference is the nested form in the first example. This is heavily idealized example but reflects the same behavior if i nest components and dialogs. Whenever a form is nested, the above error occurs in IE8. FF and others just open the Dialog as expected.

如果避免嵌套表格,但这是不可能的,因为mojarra不允许我放置,例如一个组件中包含的commandLink,没有用表单覆盖它。

If would avoid to nest forms but this is impossible because mojarra would not allow me to put, e.g. a commandLink that is contained in a component without sorrounding it by a form.

CommandButton的行为方式相同。我已经阅读了几个与IE的错误消息相关的其他方法和错误,但没有找到任何解决方案或有用的提示。

CommandButton is behaving the same way. I've read several other approaches and bugs related to the error message of the IE but did'nt found any solution or useful hint.

以下对我来说很有意思:

The following would be interesting to me:

a)您是否能够重现此给定的行为?
b)你有任何想法如何解决或解决这个问题(也许以某种方式更新jquery)?

a) Are you able to reproduce this given behavior? b) Do you have any ideas how to work around or solve this (maybe updating jquery in some way)?

Fist我试图验证我的HTML5,但是它会发生非HTML5和非常简化的HTML。

Fist i attempted to validate my HTML5, but even with non-HTML5 and very reduced html it occurs.

感谢任何帮助,提示或者提前链接到任何信息!

Thanks for any help, hint or maybe link to any information in advance!

问候,

老兄

PS:如果你认为你有所了解,请推荐我提供更多细节或所需资源,我很幸运能在这里帮助其他人!

PS: Please if you think you know something, push me to put some more details or required resources, i would be lucky to also help others here!

推荐答案

嵌套表单在HTML中是非法的。浏览器行为未指定。从JSF的角度来看,你永远不应该嵌套< h:form> 组件。

Nesting forms is illegal in HTML. The browser behaviour is unspecified. From JSF perspective, you should thus never nest <h:form> components.

至于为什么你需要嵌套表格,

As to the reason why you needed to nest the forms,


如果避免嵌套表格但是这是不可能的,因为mojarra不允许我放,例如一个组件中包含的commandLink,没有用表单覆盖它。

这不是真的。也许你正在采取以下众所周知的警告 严重。

This is not true. Perhaps you're taking the following well known warning too serious.


警告:表单组件需要在其祖先中具有UIForm。建议:将必要的组件包含在< h:form>

是只是一个警告,而不是一个错误。如果您的页面工作正常,那么您可以忽略该警告。只有在您将项目阶段设置为开发时,才会显示此警告。当你将它设置为生产时,它不会显示。

This is "just" a warning, not an error. If your page works fine, then you can just ignore the warning. This warning will only show when you've set the project stage to Development. It will not show when you set it to Production.

早期的Mojarra版本有一个错误当您在某个子/包含模板文件中放置命令链接时,也会出现此警告,而表单则放在主模板中(因此位于物理上不同的文件中)。升级Mojarra版本应修复此错误且令人困惑的警告。

On early Mojarra versions there was however a bug which makes this warning to also occur when you've put for example the command link in some child/include template file, while the form is placed in the master template (which is thus inside a physically different file). Upgrading the Mojarra version should fix this incorrect and confusing warning.

  • The form component needs to have a UIForm in its ancestry. Suggestion: enclose the necessary components within <h:form>
  • How to use <h:form> in JSF page? Single form? Multiple forms? Nested forms?

这篇关于JSF2.0 + Primefaces 3.0.1 + jquery 1.6.4 + p:commandLink + IE8抛出对方法或属性的意外调用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆