Stackoverflow found a Q & A, a very detailed list of possible situations, I met 7th points, I believe that friends who do JSF development will encounter such problems.
H: commandlink/h: commandbutton is not being invoked
WheneverUICommand
Component fails to invoke the associated action method or
UIInput
Element fails to update the model value, then verify the following:
UICommand
AndUIInput
Components must be placed inside
UIForm
Component, e.g..
You cannot nest multipleUIForm
Components in each other. This is namely illegal in HTML. Watch out with include files!
NoUIInput
Value validation/Conversion error shoshould have been occurred. You can use
To show any messages which are not shown by any input-specific
Components. Don't forget to includeid
Of
In<f:ajax render>
, If any, so that it will be updated as well on AJAX requests.
IfUICommand
OrUIInput
Components are placed inside an iterating component like
,<ui:repeat>
, Etc, then you need to ensure that exactly the same
value
Of the component is been preserved during the apply request values phase of the form submit request. JSF will namely reiterate over it to find the clicked link/button and submitted input values. putting the bean in the view scope and/or making
Sure that you load the data model in (post) constructor of the bean (and thus not in the getter Method !) Shocould fix it.
Therendered
Attribute of the component and all of the parent components shocould not evaluate
false
During the apply request values phase of the form submit request. JSF will namely recheck It then as part of safeguard against tampered/hacked requests. putting the bean in the view scope and/or making sure that you're preinitializing
Condition in (post) constructor of the bean shocould fix it. The same applies to
disabled
Attribute of the component, which shocould not evaluate
true
During Processing the form submit.
If you're using JSF 2.x<f:ajax>
On the Command component, make sure that you have
In the master template instead of. Otherwise JSF won't be able to auto-include the necessary
jsf.js
Javascript file which contains the Ajax functions. This wowould result in a javascript error like "mojarra is not defined" in the browser's builtin JavaScript console.
If a parent ofWith
UICommand
Button is been rendered/updated by an Ajax request beforehand, then the first action will always fail. the second and subsequent actions will work. this is caused by a bug in view State handling which is reported
JSF spec issue 790 and fixed in JSF 2.2. For JSF 2.0 and 2.1 you need to explicitly specify the ID of
Inrender
Of<f:ajax>
.
Be sure thatActionEvent
Argument
actionListener
Isjavax.faces.event.ActionEvent
And thus not
java.awt.event.ActionEvent
, Which is what most ides suggest as 1st AutoComplete option.
Be sure that noPhaseListener
Or any
EventListener
In the request-response chain has changed the JSF lifecycle to skip the invoke action phase by for example calling
FacesContext#renderResponse()
OrFacesContext#responseComplete()
.
Be sure that noFilter
OrServlet
In the same request-response chain has blocked the request fo
FacesServlet
Somehow.
My bet thatYour ParticleProblem is caused by Point 2:
Nested forms. You probably already haveIn the parent page which wraps the include file. The include file itself shocould
NotHave. You can also fix it the other way round, ensure that the parent page does
NotHaveAround the place of the include file.