• Post Reply Bookmark Topic Watch Topic
  • New Topic

Custom Component with dynamic components.  RSS feed

Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I need recommendation on what is the best way for this requirement.

I need to have a custom jsf component which will be as follows:

We have attributes (these are not tag attributes) defined in the database for various group.
Lets say the group "user", has attributes "name", "phoneNo" defined in the database. The metadata of the attributes contain information about how the attributes are to be displayed and what are the validations it needs.

I need to develop a UI compnent which will do the following
1. Read the meta data for the attributes from the database depending on the group tag-attribute passed to it .
2. Dynamically creates the UIComponents for a attribute depending on its metadata (how it was defined in the database, such as textbox etc )
3. Read the values of the attributes from a datastructure provided by the managed beans.
4. On submit of the page, repopulate the data-structure appropriately with new values after peforming validation as defined in meta-data.

I would think that the custom UI component would be called as this -->
<my:attributes group="user" data="#{managedBean.values}" />

where group is user
and the datastructure (probably a Hashmap) is provided by the attribute "data".

I would think that I would have to create a custom component.
In this custom component , I would dynamically create the UI components provided by JSF , such as one for text box etc . Add validations to it.
How do I get the user submitted values in this case ?

Or should I create a custom component.
The custom component would directly create the html text box etc . I would be handling the validation and mapping to the model (managedBean.values) in my custom component ?

Any ideas would be appreciated, since I am new to JSF

  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!