JSF Composite Component simple Example

Composite components can be better with little generics/reflection applied, after all the purpose is to write once and reuse it.

  • In this example I’ll pass an object to a component and it will print all its fields
  • The component will print only the fields belonging to that class not the ones inherited
  • If you want to get inherited fields use getFields instead of getDeclaredFields
  • How is this useful, in a previous article I showed how to sort a data table with ajax, but that applied only for one class, with this we can do the same for any class we declare

Component and View

Controller

Model


Recent Posts

Recent Comments

Categories