Is it possible to dynamically generate managed bean instance so it would be visible inside template?
To clarify the question:
I have several dependency fields in a multiple forms defined on the same page which uses the same set of properties. Each time I add a new registry the set is filled with different data. So when I try to submit the whole thing the first values cant apply the correspondent converter because the original values are lost to the updated ones, so the app throws an exception. In theory I could declare the same bean several times setting different alias each time but this approach limits me to some fixed quantity of bean instances and makes the whole thing look pretty ugly.
A simplified example:
1. I have a catalogue with 3 properties: states, municipalities and districts defined in a managed bean as List<SelectItem> to simplify the injection into the rich:comboBox elements. Each time I select a state the municipality property is getting filled with correspondent data and related comboBox is updated. Same happens for district when I chose a municipality. To solve the context persistence problem I use rich:keepAlive tag.
2. Later in the form I have an additional info in its independent form which has a similar set of fields (just different target values and ids) that use the same approach using the same managed bean. And of course after I fill the last ones catalog.municipalities and catalog.districts are left with data different from the first set. So when I try to submit I get an error since the converter can't return text to ids from the first fieldset:
I am looking for a way to avoid usage of multiple declarations of the same managed bean in my faces config.
Wanna install linux on a vacuum cleaner. Could anyone tell me which distro sucks better?
Managed Beans are simply standard JavaBeans whose construction and cross-linkage are statically defined in the faces-config file(s). The only difference between (for example) a managed session-scope bean and a non-managed session-scope bean is that the non-managed bean has to be created, initialized and added to the session by you.
An IDE is no substitute for an Intelligent Developer.
Thanks for the answer and sorry for the red text. Didn't know this: I'm aware each community has its unofficial rules. I spent several years of my life fighting for clean messages on codeguru forums myself and I'm new to coderanch. Will behave myself, promise...