-
1. Re: Empty dropdown list
ckraus Dec 13, 2010 11:44 AM (in response to mathandos)Hi Thandos,
I think something like this should work...
<a4j:repeat id="courseList" value="#{studentList.courseList}" var="course"> <f:selectItem itemLabel="#{course.getKey()}" itemValue="#{course.getValue()}"/> </a4j:repeat>
Iterating through a HashMap returns objects of the type
java.util.Map.Entry<K, V>
Best regards,
Chris -
2. Re: Empty dropdown list
mathandos Dec 15, 2010 4:52 AM (in response to mathandos)Thank you Chris for your response.
I tried what you suggested, but to no avail.
Honestly don't know if i'm doing something wrong.
Funny thing is if I move a4j:repeat outside h:selectOneMenu, then i get multiple dropdown lists and each showing individual courseNames
Thanking you in advance
Thandos -
3. Re: Empty dropdown list
antibrumm.mfrey0.bluewin.ch Dec 15, 2010 5:14 AM (in response to mathandos)Hi Thandos
Can you not use the f:items tag and call a function which returns you a list of select items? I've always used this approach to havedynamic
select values. If you work directly with entities i use normally the s:items tag.Something like this:
<h:selectOneMenu id="selectValue" value="#{action.type}"> <f:selectItems value="#{actionTypeListItems}" /> </h:selectOneMenu>
/** * Gets the action type list items. * * @return the action type list items */ @Factory(value = "actionTypeListItems", scope = ScopeType.APPLICATION) public List<SelectItem> getActionTypeListItems() { List<SelectItem> result = new ArrayList<SelectItem>(); result.add(new SelectItem(null, "Select an action type")); result.add(new SelectItem(ActionType.CORRECTIVE)); result.add(new SelectItem(ActionType.PREVENTIVE)); return result; }
-
4. Re: Empty dropdown list
mathandos Dec 15, 2010 7:51 AM (in response to mathandos)Hi Martin
I also tried returnig SelectItem, but it still made no change.
Just to add on...
I have two databases
Course (entity CourseDetails, fields - pkCourse, courseName)and
Student (entity StudentDetails, fields - pkStudent, studentName, fkCourse),entities where generated using seam-gen.export both course and student as two separate war files. I've managed to get them to communicate with each other through services and ESB.
Now in student jsf I've created a dropdown for fkCourse to display courseNames, but in my case it shows nothing.Hope it's a bit clear as to what I'm trying to do.
If there is an alternative workaround to what I'm trying to achieve, it will be appreciated.
Thanking you in advance
Thandos