I'm having a problem with JSF CommandButton action not being invoked. I have a managed bean roleController, as in
@ManagedBean(name = "roleController")
@RequestScoped
public class RoleController {
public Role getSelectedRole() {
return selectedRole;
}
public void updateSelectedRole() {
System.out.println(selectedRole.getRole());
}
In my .jsf file I'm trying to edit invoke updateSelectedRole action on h:commandButton, but it doesn't seem to work. I've tried to change the method name to incorrect one, and there's no exception thrown - but when I do the same with other form, the exception is thrown - so most likely the action isn't even invoked.
<h:panelGroup rendered="${param.action == 'edit'}">
<h:form>
<ol>
<li>
<label for="ID">
<h:outputText value="#{msg.roleEditID}" />
</label>
<h:inputText readonly="true"
value="#{roleController.selectedRole.id}" />
</li>
<li>
<label for="Role">
<h:outputText value="#{msg.roleEditRole}" />
</label>
<h:inputText value="#{roleController.selectedRole.role}" />
</li>
<li>
<h:commandButton value="#{msg.buttonUpdate}"
action="#{roleController.updateSelectedRole()}"/>
</li>
</ol>
</h:form>
</h:panelGroup>
I found that it may be caused be nested forms, but that's not the case in this example. Is it possible that the root of this problem is my navigation rule?
<navigation-rule>
<from-view-id>/admin/roles.xhtml</from-view-id>
<navigation-case>
<to-view-id>/admin/roles.xhtml</to-view-id>
<from-outcome>true</from-outcome>
<redirect>
<view-param>
<name>action</name>
<value>edit</value>
</view-param>
</redirect>
</navigation-case>
</navigation-rule>