Hi, i need some help with displaying several selectOneMenu's from DB. Each one has it's own options, stored in DB too.
so i iterate answers List with dataTable. on each iteration currAnswer is an Entity that has List of answeredOption. This list i try to iterate in c:forEach to manually inser f:selectItem. scnbjectConverter is a custom converter to convert entity class to String such as "org.survey.model.VoteOption,1" (class name and Id), but it doesn't matter, model and service tier are correct and problem appeared in presentation tier
when i try to link it directly to entity list (annotated as @OneToMany) my selectOneMenu is empty (that list is fully initialized and isn't empty)
but everything works fine if i link c:forEach to List field, that i manually initialize with the same (!) answeredOption list in some backing bean:
i have very complex structure, so this solution with backing bean field isn't appropriate.
i've tried ui:repeat insted of forEach, but it didn't help too. [ July 11, 2008: Message edited by: Vlad Kolosnicin ]
Can't you use an f:selectItems tag and just get your list of entities in the backing bean and then create SelectItem objects from them? Using JSF components within c:forEach doesn't normally work very well. Something to do with the order of tag rendering and the mismatch between JSP and JSF lifecycles. c:forEach doesn't normally work with facelets either.
Joined: Jul 11, 2008
2 Zack Marrapese thanks for my mind direction. For personal usability i've added new transient field into my entity to get ready-to-use list of SelectedItem:
on the page simply :
it isn't pure MVC, but has less code. and works fine)