In the Question commandButton/commandLink/ajax action/listener method not invoked or input value not updated there are 7 issues mentioned. Now, I have the same problem, but I don't see which of the issues mentioned are causes the problem I'm having... nor did I manage to find the solution in any articles I've read. I have an h:commandLink inside a snippet, which is in :main:profileContentSnippet in regard to the project:
...
<h:commandLink action="#{usersController.prepareModel}" value="ViewDetails" immediate="true">
<f:param name="pageViewId" value="EditDetails"/>
<f:ajax render=":main:profileContentSnippet" />
</h:commandLink>
...
Now, it is supposed to render :main:profileContentSnippet and modify it to present another snippet (which the commandLink is not a part of...). It renders EditProfilePersonalDetails, as sent by parameter. The commandLink action doesn't fire. Now if I remove it from the snippet that holds it, it works, but the h:commandLink is still there - and I wish it to disappear, as the snippet it resided on did... I wonder why's that? How can a control modify its own appearance if it is inside the snippet that is about to be replaced by another snippet using AJAX?
Thanks in advance.
Additional code:
The snippetFileName should change (and it is) after clicking on the h:commandLink from above. Now, the file that contains the h:commnandLink is replaced by:
<h:panelGroup id="messagePanel" layout="block">
<h:messages errorStyle="color: red" infoStyle="color: green" layout="table"/>
</h:panelGroup>
</ui:composition>
Note: the h:commnadLink is in a ui:composition too. The Action in the managed bean that should be fired is:
@ManagedBean (name="usersController") @RequestScoped public class UsersController { public String prepareConnected() { //need to add getting user id from session System.out.println("in prepareConnected"); current = ejbFacade.find( (long)2);
if (current == null){
System.out.println("in prepareConnected is null");
JsfUtil.addSuccessMessage("User Deleted in other request");
return null;
}
return "viewPersonalDetails-snippet";
}
} ...
This include part holds the commandLink from above:
<h:panelGroup id="profileContentSnippet" >
<ui:include src="#{snippetsProfileLinkerBean.snippetFileName}"/>
</h:panelGroup>
basically, the snippet is modified, but the current variable stays null since the preapareConnected doesn't fire. If I remove it from the snippet to other part in the site that is not in the include part it works. The problem is that I wish the h:commandLink part will disappear as well.`