简体   繁体   English

使用绑定属性会导致javax.faces.FacesException:找不到带有标识符的组件

[英]Using binding attribute causes javax.faces.FacesException: Cannot find component with identifier

I have a problem I can't quite get a handle on. 我有一个我无法完全解决的问题。

First the context: I am developing a web application using Primefaces 3.5 (yes, unfortunately I am stuck with this old version for now), running on JBoss 7. 首先是上下文:我正在使用在JBoss 7上运行的Primefaces 3.5开发Web应用程序(是的,不幸的是,我暂时仍然使用旧版本)。

There is a form with id "form" encompassing all following xhtml code. 有一个包含所有以下xhtml代码的ID为“ form”的表单。

I have a component in my view which is provided by usage of the binding attribute: 我的视图中有一个通过使用binding属性提供的组件:

<p:dashboard id="dashboard" binding="#{myBackingBean.dashboard}" />

Then sometimes I would like to perform an ajax update on this component, this is done by using the RemoteCommand component of primefaces: 然后有时我想对该组件执行ajax更新,这是通过使用primefaces的RemoteCommand组件完成的:

<p:remoteCommand
actionListener="#{myBackingBean.someActionListener()}"
process="@this" id="myRmtCmd" oncomplete="myJsFunction();"
update=":form:dashboard" name="myRemoteCommand" />

The RemoteCommand is triggered by a clicking on a Link: 单击链接可触发RemoteCommand:

<a href="#!" onclick="myRemoteCommand();">Some Text</a>

This works pretty well so far. 到目前为止,效果很好。 However after deploying this code to production I sometimes get a FacesException: 但是,在将此代码部署到生产环境后,有时会遇到FacesException:

javax.faces.FacesException: Cannot find component with identifier ":form:dashboard"
referenced from "form:myRmtCmd".

This is where my problem lies because I cannot reliably reproduce this exception. 这是我的问题所在,因为我无法可靠地重现此异常。 My question is this: What could lead to this exception being thrown? 我的问题是:什么可能导致引发此异常? It seems to work 95 % of the time but being the perfectionist I am (and many of you reading this are as well, I'm sure ;) ) I would like this code to work 100 % of the time. 它似乎在95%的时间内都能正常工作,但作为我的完美主义者(我敢肯定,许多阅读本书的人也是如此;))我希望这段代码在100%的时间内都能正常工作。 What am I missing? 我想念什么?

Before answering please consider these constraints: 在回答之前,请考虑以下约束:

  • yes, i have to use the binding attribute for providing the dashboard as I need a great deal of control over what gets added to the component 是的,我必须使用绑定属性来提供仪表板,因为我需要对添加到组件的内容进行大量控制
  • to avoid using IDs I also tried updating the dashboard by its css class via one of primefaces' advanced selectors: @(.ui-dashboard) - this also does not work! 为了避免使用ID,我还尝试通过primefaces的高级选择器之一通过其css类更新仪表板:@(。ui-dashboard)-这也不起作用!
  • yes, it would be possible to use a commandbutton/link instead of wiring up the remotecommand component to a simple html link but in this case the link is rendered by a JSF renderer component and I made some bad experiences with dynamically adding buttons etc (due to JSF Spec Issue 790 ) 是的,有可能使用命令按钮/链接而不是将remotecommand组件连接到简单的html链接,但是在这种情况下,该链接是由JSF渲染器组件渲染的,我在动态添加按钮等方面有一些不好的经验(由于到JSF Spec Issue 790

Cheers, ps 欢呼声,ps

I also had this weird behavior. 我也有这种奇怪的行为。

There are probably more than one component bindded to #{myBackingBean.dashboard} , so the first one sets the id and there will be no one called " dashboard ". 绑定到#{myBackingBean.dashboard}组件可能不止一个,因此第一个组件设置ID,并且将没有一个称为“ 仪表板 ”的组件。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 <t:panelNavigation2>导致javax.faces.FacesException:不能两次添加相同的组件 - <t:panelNavigation2> causes javax.faces.FacesException: Cannot add the same component twice jsf:更新组件(表格单元格&lt;-&gt;详细信息面板)=&gt; javax.faces.FacesException:找不到带有表达式的组件 - jsf: update component (table cell <-> detail panel) => javax.faces.FacesException: Cannot find component with expression 复合组件javax.faces.FacesException:在视图中找不到组件“ inputID” - Composite component javax.faces.FacesException: Cannot find component “inputID” in view javax.faces.FacesException:找不到滑块目标组件&#39;txt6; txt7&#39;检视 - javax.faces.FacesException: Cannot find slider target component 'txt6; txt7' in view javax.faces.FacesException:不能两次添加相同的组件:javascript_runner - javax.faces.FacesException: Cannot add the same component twice: javascript_runner jsf 1.2到jsf 2.2的迁移原因:javax.faces.FacesException - jsf 1.2 to jsf 2.2 migration causes: javax.faces.FacesException javax.faces.FacesException:断言失败 - javax.faces.FacesException: Assertion Failed javax.faces.FacesException:表达式错误:命名对象:org.omnifaces.component.validator.ValidateMultiple 未找到 - javax.faces.FacesException: Expression Error: Named Object: org.omnifaces.component.validator.ValidateMultiple not found Wildfly 从错误开始。 javax.faces.FacesException:无法找到 CDI BeanManager - Wildfly starts with error. javax.faces.FacesException: Unable to find CDI BeanManager javax.faces.FacesException:表达式错误:命名对象:找不到播放器 - javax.faces.FacesException: Expression Error: Named Object: player not found
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM