Dynamically generate JSF components.
Posted on 2004-08-31
There doesnt seem to be a JSF category, so I guess heres the best place to ask.
Ill try to use an example to illustrate my problem. Say you want to manage a company contact list and you have many companies. Basically you have many companies and each company has a list of contacts. Each company screen has a dynamic contact list. The display is like.
Contact 1:<input box>Bugs Bunny</input box>
Contact 2:<input box>Daffy Duck</input box>
If the user clicks on Add Contact, I want to create a new contact info line with associated input. All the JSF examples I have seen thus far "hard code" these input boxes. How do I do this dynamically? Im assuming there will be something like an array of inputText's in the backing bean. But how can I dynamically show this?
I would imagine I would need to put some sort of place holder in the JSF page and then somehow ask it to render 1 to many of these controls that I am generating in the backing bean.
Im new to JSF/JSP, so forgive me if my question is confusing.