[jboss-user] [JBoss Seam] - Re: generating forms programatically

jcruise do-not-reply at jboss.com
Fri Nov 30 04:32:04 EST 2007


The renderers are just the metadata-driven generic form templates. I chose to use facelets to generate the forms rather than building custom jsf controls because it has such great composition functionality. I considered writing a jsf control for a custom grid or panel that was driven by my metadata model components. However, that seemed like hard, error prone work and it would be difficult to keep up with the state of the art in JSF gui's. In essence I didn't want to be building yet another JSF GUI lib. So I use facelets to dynamically build the higher level UI abstractions on top of the component set du jour.

The form templates (renderers) basically just loop over metadata using c:forEach to insert fields components into the page. I use facelets source tags for the "master" field component (to make the parameter passing nice), and within that I use ui:include with an expression for the src attribute to dynamically include correct jsf tags for the particular field type.

The essence of this approach is that the c: tags are processed before the rest of the jsf lifecycle processing, so they effectively act as a component tree generator.

Hope this helps.

Cheers
J

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4109191#4109191

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4109191



More information about the jboss-user mailing list