Often the most important part of the news is what they didn't tell.
Often the most important part of the news is what they didn't tell.
Tim Holloway wrote:"onsubmit" is a javascript attribute corresponding the the HTML FORM onsubmit javascript attribute. It does not execute any Java code on the server, only Javascript code on the client.
As I mentioned, JSF dialog boxes are not OS-level dialog boxes. In essence, they are overlay HTML DIV elements that can be displayed or hidden over the top of the rest of the HTML page. It's all done in Javascript, no server-side code is involved and no separate dialog window pops open.
The Primefaces Dialog control has to be paired with a JSF h:form control, I forget which one has to contain the other, but it's in the documentation. The dialog JSF form works like any other JSF h:form in that in order to submit the form, and thereby trigger a JSF action method, you have to either use a JSF command control (h:commandButton, h:commandLink) or use AJAX. For command controls, the 'action=' attribute defines a reference to a backing bean method. NOT a method call. JSF does the actual method call, not the form. Thus: 'action="#{myBean.loadComponents}"', which would cause the backing bean's "public String loadComponents()" method to be invoked when the button or link was clicked.
AJAX operation is similar, except that instead of specifying a "public String method()" action method, you specify a reference to an AJAXListener method, whose signature is something like "public void myListener(AjaxEvent event)".
A full form submit (commandButton/commandLink) causes the entire form's input control values to be sent to the server, and if they are valid, the backing bean updates their corresponding properties, the action method is invoked, and then JSF navigates to whatever page the action method returns a reference to. Which, if it's null, would be the same page. Or, if the action is "immediate", the property validation and updating is skipped and the action method is invoked directly.
An AJAX submit is essentially the same process except that you can limit what input values from the form will be submitted and instead of rendering a fresh copy of the page, you can indicate that only selected parts of the current page should be updated.
Finally, note that when you display a primefaces dialog, all that's actually happening is that Javascript is making an existing DIV visible. The contents of that displayed DIV - including its control values - will be whatever they were when the page was initially displayed unless you have some sort of JavaScript or AJAX logic that updates them,
Space pants. Tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
|