Showing posts from January 6, 2012

Passing action methods into Facelets tags

The problem JSF, via Facelets, has various mechanisms to easily reuse view content. One of those is the Facelets tag, which allows one to reuse markup and/or components. One notorious problem with these Facelets tags is that you can't directly pass action methods (method expressions) into them. There's a workaround where you break the expression into two parts, the base (which should be a value expression) and the name of the method as a plain string. Inside the tag these two are then combined again, e.g. via the array notation syntax. See e.g. Passing action methods in Facelets using array notationFacelets Param for action method Another approach is to create a small helper tag that converts the value expression in some way into a method expression. There have been a couple of implementations of this idea: Creating composite controls with JSF and faceletsHow the button is created and how it acts(see ActionMapperTagHandler at the bottom of the page) Finding a solution I…