[英]Updating ui:defined form content from Master template (JSF & Primefaces)
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.
信息:在视图中找不到标识符为“ formName”的组件。
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. 基本上,我有一个主模板文件,其中包含许多
<p:dialog>
组件,这些组件具有各种CRUD功能。 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). 当用户与这些组件进行交互时,我使用内置的primefaces“更新”功能对
<ui:defined>
页面中的各种表单/组件进行jaja更新。 However, because of the layout the JSF web-app (ie 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. 但是,由于JSF Web应用程序的布局(即Master模板和ui:defined网页)以及我已经在Master模板文件中定义了这些组件的事实,这意味着可更新的表单/组件并不一定在当前视图中并在上方抛出警告消息。
For Example: 例如:
If I had my Master Template file: master.xhtml with a component called < p:dialog id="componentA" />
. 如果我有主模板文件:master.xhtml,其组件名为<
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? 然后我有一个带有
<h:form id=page1Form/>
,同样,我也有一个带有<h:form id=page2Form/>
,它们都包含由sessionscoped支持的bean提供的信息。如果使用componentA进行CRUD操作,是否是确保更新这些表格的最佳方法? 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. 目前,我只是使用<
p:dialog id="componentA" update="page1Form, page2Form" />
但是由于视图中只有page1或page2,因此Tomcat吐出了以上消息。 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? 因此,可以根据我所在的页面动态指定要更新的表单/组件,还是我必须在每个
<ui:define>
页面上都指定componentA(这会重复很多html /代码,因此不太容易管理) ),还是有一种方法可以更新当前视图中的所有表单/组件? Or is what I am doing correct and I should just turn off development mode in my web.xml to cease the messages? 还是我做的正确,我应该在web.xml中关闭开发模式以停止消息?
Cheers 干杯
Ally 盟国
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. 通过使用
<ui:param name="paramName" value:"a value"/>
值,我设法解决了上述问题。
Essentially in your master template file specify your component like you would ie 本质上,在主模板文件中指定组件,就像
<p:commandButton value="Submit" action="#{someBean.doSomeStuff()}"
update="#{paramName}" />
Then in your <ui:composition>
page you simply state param name and its value: 然后在
<ui:composition>
页面中,只需声明参数名称及其值:
<ui:param name="paramName" value="someForm someOtherForm"/>
jobs a goodun! 求职!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.