ui:component | a4j:commandButton action returning null
scottaii Oct 27, 2009 6:03 AMHello there,
Im having a problem creating my own button component. I have searched high and lo but to no avail.
What im trying to do
I am trying to create my own button tag by putting it into a component.
This button must include:
Enable = true/false
enabledImage=enabled.png
disabledImage=disabled.png
enabledToolTip="MessageBundle.enabledToolTip"
disabledToolTip="MessageBundle.disabledToolTip"
These are the basic funtions that the button should have. The button should also have the normal a4j:commandbutton attributes.
Whats wrong?
I am having problems with the action attribute. When i call a simple method to a Bean, the method is called (hits the breakpoint), but i get an error-
/components/ButtonComponent.xhtml @16,40 action="#{actionbutton}": Identity 'actionbutton' was null and was unable to invoke
This is my button component:
<ui:component xmlns="http://www.w3.org/1999/xhtml" xmlns:s="http://jboss.com/products/seam/taglib" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" xmlns:rich="http://richfaces.org/rich" xmlns:a4j="http://richfaces.org/a4j"> <a4j:commandButton id="#{id}" rendered="#{enable}" styleClass="#{styleClass}" action="#{actionbutton}" oncomplete="#{oncomplete}" reRender="#{reRender}" ajaxSingle="#{ajaxSingle}" image="#{enabledImage}"> <rich:toolTip value="#{enabledToolTip}"/> </a4j:commandButton> <h:graphicImage id="#{id}Disabled" rendered="#{!enable}" styleClass="#{styleClassDis}" style="#{styleDis}" value="#{disabledImage}"> <rich:toolTip value="#{disabledToolTip}"/> </h:graphicImage> </ui:component>
This is how my component looks in the XML:
................ <cog:button id="deleteuserbutton" enable="#{((userAdmin.hasPermission(userAdmin.adminRole)) and (userAdmin.selectedUsersList.size() > 0))}" enabledImage="/img/user_delete.png" disabledImage="/img/disabled/user_delete.png" enabledToolTip="This toolTip is Enabled" disabledToolTip="This toolTip is disabled" reRender="userConfirmDeleteContainer,userRejectDeleteContainer" oncomplete="displayDialog('#userConfirmDelete');displayDialog('#userRejectDelete');" actionbutton="#{userAdmin.confirmDeleteUsers()}" ajaxSingle="true" styleClass="roleToolBarButton" styleClassDis="roleToolBarButton"> </cog:button>
I have included the reRender e.c.t just so you can see the type of thing i am trying to achive.
Has anybody tryed anything like this before?