• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

Custom Component with dynamic components.

Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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

You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
    Bookmark Topic Watch Topic
  • New Topic