myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From José Luis Cetina <maxtorz...@gmail.com>
Subject Custom tag
Date Thu, 28 Jun 2012 21:28:54 GMT
Hi i have this:

Simple custom tag:

<cc: interface componentType="my_button" >
  <cc:attribute name="action" method-signature="java.lang.String action()"/>
  <cc:attribute name="actionListener" method-signature="void
actionListener(javax.faces.event.ActionEvent event)"/>
</ cc:interface>

<cc:implementation>
    <h:commandButton
                value="Ok"
                action="#{cc.attrs.action}"
                actionListener="#{cc.attrs.actionListener}"
     />
</cc:implementation>

Then in my page i do:

<mytags:mybutton action="#{myBean.actionMethod}"/>

But i get a NullPointerException, this is because im not setting the
actionListener attribute, but the thing is that sometimes i need or
only action or actionlistener not both, but i have to provided both if
not i get the nullpointer.


I have to do this, but the listener method is empty in my managedbean,
i only do this for avoid the nullpointer.
<mytags:mybutton action="#{myBean.actionMethod}"
actionListener="#{myBean.actionListenerMethod}"/>

how can i avoid this?

Thanks

-------------------------------------------------------------------
SCJA. José Luis Cetina
-------------------------------------------------------------------

Mime
View raw message