19220

Updating ui:defined form content from Master template (JSF & Primefaces)

Question:

I am having a little trouble with my web-app, essentially I keep getting an warning message:

<blockquote>

INFO: Cannot find component with identifier "formName" in view.

</blockquote>

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

Answer1:

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.

<p:commandButton value="Submit" action="#{someBean.doSomeStuff()}" update="#{paramName}" />

Then in your <ui:composition> page you simply state param name and its value:

<ui:param name="paramName" value="someForm someOtherForm"/>

jobs a goodun!

Recommend

  • Overriding operator*() of iterators
  • Inserting HTML template into tinymce 4 editor [closed]
  • TagException … null (File not found) on creating custom Facelets tag [duplicate]
  • How would I call a JavaScript function from a JSF Bean?
  • Drag and Drop between different layout units in Primefaces
  • pythonic way to find all potential longest sequence
  • Sum and Average of a series of numbers inputed to a text field
  • Spring MVC redirect with custom http headers
  • JSF2.0 + Primefaces 3.0.1 + jquery 1.6.4 + p:commandLink + IE8 throws Unexpected call to method or p
  • WPF version of .ScaleControl?
  • How to synchronize jQuery dialog box to act like alert() of Javascript
  • Android Activity.onWindowFocusChanged doesn't get called from within TabHost
  • how to upload multiple files in c# windows application
  • How to handle images sent by a mobile device?
  • Why Encoding.ASCII != ASCIIEncoding.Default in C#?
  • one Local Olampyad Questions on Informatic in 2011
  • Highlight one bar in a series in highcharts?
  • Lost migrations and Azure database is now out of sync
  • Change JButton Shape while respecting Look And Feel
  • Is there any way to access browser form field suggestions from JavaScript?
  • Android screen density dpi vs ppi
  • Dynamically accessing properties of knockoutjs observable array
  • recyclerView does not call the onBindViewHolder when scroll in the view
  • script to move all files from one location to another location
  • WinForms: two way TextBox problem
  • Can I make an Android app that runs a web view in Chrome 39?
  • htaccess rewriting URLs with multiple forward slashes
  • Display Images one by one with next and previous functionality
  • jQuery tmpl and DataLink beta
  • Web-crawler for facebook in python
  • align graphs with different xlab
  • A cron job substitute?
  • KeystoneJS: Relationships in Admin UI not updating
  • Turn off referential integrity in Derby? is it possible?
  • Authorize attributes not working in MVC 4
  • Busy indicator not showing up in wpf window [duplicate]
  • Unable to use reactive element in my shiny app
  • Python/Django TangoWithDjango Models and Databases
  • Net Present Value in Excel for Grouped Recurring CF
  • jQuery Masonry / Isotope and fluid images: Momentary overlap on window resize