jsp - Drop down list with values from database shows empty in Liferay -
i want display values in drop-down list comes database. code follows in <form>
:
<aui:select id="empname" name="empname"> <% employee employee; employee newemployee = new employeeimpl(); int totalemployees = employeelocalserviceutil.getemployeescount(); for(int i=0; i<totalemployees;i++) { %> <aui:option name = "opt" value ='<%=string.valueof(newemployee.getempfname())%>' /> system.out.println("newemployee.getfname string value in loop: " +newemployee.getempfname()); <% } %> </aui:select>
it shows big empty list.
what should values in drop down list database?
i can make out following code have given:
employee newemployee = new employeeimpl(); int totalemployees = employeelocalserviceutil.getemployeescount();
this code before for
loop, doing getting total-count
instead of actual list of employees
.
and here inside for-loop:
<aui:option name = "opt" value ='<%=string.valueof(newemployee.getempfname())%>' />
you fetching empty string ""
or null
value through code newemployee.getempfname()
since newemployee
object not database created in jsp , hence big empty list :-)
i think need return list<employee>
totalemployees
(total-count) database rather creating new instance , calling .getempfname()
on instance.
Comments
Post a Comment