我的网络应用程序遇到了一些问题,基本上我不断收到警告消息:
信息:在视图中找不到标识符为“formName”的组件。
我知道为什么会发生这种情况,但我只需要确定它们是否是修复/更好的解决方案。
基本上我有一个主模板文件,其中包含许多
组件,这些组件具有各种 CRUD 功能。当用户与这些组件交互时,我使用内置的 primefaces 'update' 函数以 ajax 方式更新
页面中的各种表单/组件。但是,由于 JSF Web 应用程序的布局(即主模板和 ui:define 网页)以及我已在主模板文件中定义这些组件的事实,这意味着可更新的表单/组件不一定是可更新的表单/组件。在当前视图中并抛出上面的警告消息。
例如:
如果我有一个主模板文件:master.xhtml,其中包含一个名为 <p:dialog id="componentA" />
的组件。然后我有一个带有
的 page1.xhtml ,类似地我有一个带有 > 的 page2.xhtml 。
,它们都包含由 sessionscoped 支持 bean 提供的信息,那么如果使用 componentA 发生 CRUD 操作,确保更新这些表单的最佳方法是什么?目前我只是使用 <p:dialog id="componentA" update="page1Form, page2Form" />
但由于视图中只有 page1 或 page2,Tomcat 会吐出以上消息。那么是否可以根据我所在的页面动态指定要更新的表单/组件,或者我是否必须在每个
页面上指定 componentA(这将是很多重复 html/代码并且不是特别易于管理)或者是否有一种方法可以更新当前视图中的所有表单/组件?或者我正在做的事情是否正确,我应该关闭 web.xml 中的开发模式以停止消息?
干杯
盟友
I am having a little trouble with my web-app, essentially I keep getting an warning message:
INFO: Cannot find component with identifier "formName" in view.
I know why this is happening, but I just need to determine if their is a fix/better solution.
Basically I have a master template file that contains a number of <p:dialog>
components, which have various CRUD capabilities. When a user interacts with these components I use the inbuilt primefaces 'update' function to ajaxically update the various forms/components in the <ui:defined>
page(s). However, because of the layout the JSF web-app (i.e. Master template and ui:defined web pages) and the fact that I have defined these components in the Master template file, it means that the update-able forms/components are not necessarily in the current view and throwing the warning message above.
For Example:
If I had my Master Template file: master.xhtml with a component called <p:dialog id="componentA" />
. And then I had page1.xhtml with a <h:form id=page1Form/>
and similarly I have a page2.xhtml with <h:form id=page2Form/>
, which both contained information provided by a sessionscoped backing bean, what would be the best method to ensure that these forms are updated if a CRUD operation occurs using componentA? At the moment I am simply using <p:dialog id="componentA" update="page1Form, page2Form" />
but because only page1 or page2 are is in the view, Tomcat spits out the above message. So is it possible to dynamically specify the forms/components to update dependant on the page I am on, or do I have to specify componentA on every <ui:define>
page (which would be lots of repeating html/code and not particularly manageable) or is there a method to update all forms/components in the current view? Or is what I am doing correct and I should just turn off development mode in my web.xml to cease the messages?
Cheers
Ally
发布评论
评论(1)
只是为了确认是否有人偶然发现此线程。我设法使用
值解决了上述问题。本质上,在您的主模板文件中像您一样指定您的组件,
然后在您的
页面中,您只需声明参数名称及其值:jobs a goodun!
Just to confirm, if anyone stumbles upon this thread. I managed to fix my above problem by using the
<ui:param name="paramName" value:"a value"/>
value.Essentially in your master template file specify your component like you would i.e.
Then in your
<ui:composition>
page you simply state param name and its value:jobs a goodun!