Primefaces dialog + commandButton

You can try either of the following , I vote number one, it’s a cleaner design IMO Bring the <p:dialog/> outside of the general <h:form/> and put an <h:form/> inside it instead <p:dialog id=”dlg” header=”#{messages.chooseSkillLevel}” widgetVar=”dlg” modal=”true” dynamic=”true”> <h:form> <h:dataTable value=”#{editSkills.skillsAndLevels}” var=”skillslevel”> <h:column> #{skillslevel.skill.umiejetnosc} </h:column> <h:column> <p:selectOneMenu value=”#{skillslevel.level}” > <f:selectItems value=”#{editSkills.levels}” var=”level” itemLabel=”#{level.stopien}” itemValue=”#{level.id}” /> … Read more

Render multiple components with f:ajax

You can render multiple components with single f:ajax. Just make sure all individual components you want to update have an id. In your sample it would be something like: <f:ajax execute=”search_form” render=”linear1 linear2″/> Where the IDs need to be separated by just whitespace like linear1 linear2 and not commaseparated like linear1, linear2 (that works only … Read more

p:commandButton vs. h:commandButton

Like @Partlov wrote in the comments below the question, Main difference is that p:commandButton is AJAX by default, and h:commandButton is non-AJAX by default. So <p:commandButton … /> is more like <h:commandButton …> <f:ajax/> </h:commandButton> but <p:commandButton …> <p:ajax/> </p:commandButton> is wrong and leads to undefined behaviour or the other way around <h:commandButton … /> … Read more

Open new window by POST using h:commandButton

The only non-JS way is to set target=”_blank” in the parent <h:form>. <h:form target=”_blank”> … <h:commandButton value=”Open in new Window” /> </h:form> This however affects all non-ajax(!) actions which are performed in the very same form. So if you’re smart, make the action which shouldn’t open in a new window an ajax action. However, ajax … Read more

How make commandButton not fully refresh page? How to use f:ajax?

Make use of Ajax. It’s a matter of nesting <f:ajax> inside the command button of interest. <h:form> … <h:commandButton …> <f:ajax execute=”@form” render=”@none” /> </h:commandButton> </h:form> Particularly the render=”@none” (which is the default value anyway, you could just omit the attribute altogether) will instruct JSF to re-render just nothing after the submit. If you intend … Read more

Execution order of events when pressing PrimeFaces p:commandButton

It failed because you used ajax=”false”. This fires a full synchronous request which in turn causes a full page reload, causing the oncomplete to be never fired (note that all other ajax-related attributes like process, onstart, onsuccess, onerror and update are also never fired). That it worked when you removed actionListener is also impossible. It … Read more

Trying to understand immediate=”true” skipping inputs when it shouldn’t

With immediate=”true” on the button, the action is indeed invoked during apply request values phase and all the remaining phases are skipped. That’s also the sole point of this attribute: process (decode, validate, update and invoke) the component immediately during apply request values phase. All inputs which do not have immediate=”true” are ignored anyway. Only … Read more