
As promised, this is the same Confirmation dialog as here but now it’s packaged as a Facelet custom tag so it’s much easier to reuse.
.rich-mpnl-body {text-align: center}
Line #9 is a new name space for the custom tag.
Line #19 is where I’m using the new custom tag. I’m passing in two things; button label and the action to be invoked if the user clicks OK on the confirmation dialog.
confirmation.xhtml:
This page is very similar to the one from previous post. From the page avobe, I’m passing in two things: button label #{label} (line #10) and the action to be invoked #{action.save} (line #13). Facelets takes care of wiring the EL expressions automatically, so we don’t have to do anything special for that to work.
Confirmation
Now, to use it as a custom tag there are two more things we need to do. First, create a taglib file and then register in web.xml.
confirmation-taglib.xml
confirmation-taglib is a Facelet taglib file that defines the tag. In this case, we are simply pointing to the source file to create the custom tag. It should be placed under /WEB-INF directory (/WEB-INF/tags/confirmation-taglib.xml):
http://richfaces.org/richx confirm tags/confirmation.xhtml
Finally, we need to register the custom taglib file in web.xml:
facelets.LIBRARIES /WEB-INF/confirmation-taglib.xml
Confirmation dialog icon was downloaded form DesignMagus.
Leave a comment