Version 6

    Facelets (Source) Tags


    These are a key feature of facelets but there are no examples and the reference manual gives gives only the bare bones.


    Example - Requirement


    Resuable Yes/No Buttons which can have custom actions defined.



    Use - examplePage.xhtml


    <my:yesNoButtons yesBean="The specified item was not found." yesAction="deleteUser" noBean="" noAction="deleteCity" />



    Source - yesNoButtons.xhtml


    <html xmlns=""
          <h:commandButton value="Yes" action="#{yesBean[yesAction]}"></h:commandButton> <h:commandButton value="No" action="#{noBean[noAction]}"></h:commandButton>





    These files live in WEB-INF.




    facelets taglib - my.taglib.xml

    <!DOCTYPE facelet-taglib PUBLIC 
      "-//Sun Microsystems, Inc.//DTD Facelet Taglib 1.0//EN"



    Web.xml - web.xml



    Of course, you could also apply a default style to your buttons, allow i8ln messages to be used as button labels, theme the buttons, allow view-id's to be passed for navigation...