I have a DB table and I want to create filters to apply to it with a mask.
I fill a HashMap and submit it to the JPA function....
I want to display label and inputText to fill two array (one for label, "nomi", and one for values, "valori"), but records in the maps are non static. An user must "add" a filter choosing from the available fields.
It must be done in jsf page in this way:
"nomi" and "valori" are of type List<String>... with add button i add the string "newChoise" to the list "nomi" and then I update the panel. It works.
Now, i have a panel binded to a java bean properties and inside this i want to insert the code above...how it can be done?
For storing the label and value, you can think of Value Object. Then use an ArrayList to store table data as a collection. The value object provides extensibility so you can add new parameters in future very easily.
Your question is little unclear on where you are having problem. So have answered generally by looking at your code.
Joined: Apr 08, 2013
Thanks for reply.
I'm sorry, I was not clear.
My xhtml looks like
sessioneUtente is a session bean and pannelloModuloAttivo is of type "org.primefaces. ... .Panel".
pannelloModuloAttivo is filled inside bean function.
I append to this component all the components that I want to show with pannelloModuloAttivo.getChildren().add(newComponent).
For now, I solved in that way: I have a List<Field> listaCampi and each element of list is a column of the db table.
For each element, i draw a checkbox, a label, a select and 2 input text inside a dialog:
This function return a dialog that is appended to the panel "pannelloModuloAttivo". This dialog has static field: if the entity has 10 columns, I have 10 rows in the dialog.
What i want to achieve is:
to use a List filterList that contains only query used filter;
to add a filter to filterList by ajax function;
to remove unused filter from dialog with a button;
I can do it with a lot of functions and re-drawing the dialog. If i use a ui-repeat-like system, it will be more simple,readable and maintainable.
There is a way to add by java code a ui:repeat component to the panel above?
As a general rule, I discourage both the use of ui:repeat AND the creation of JSF Components in Java code. Both have their uses, but there are much cleaner ways to display and update tables of data rows from a database. Use an h:dataTable and DataModel instead.
Customer surveys are for companies who didn't pay proper attention to begin with.