To get the object of listbox in Datatable

hi all,

in my project i have a table component which contain a checkbox,some static text and one listbox.When th page submits i need the selected options of the listbox.I also uses the checkbox to select.I am getting the rows which are checked.I need to get the selected optios also.Can anyone help me please

Thanks & Regards

Sree

[359 byte] By [harisree] at [2007-11-14]
# 1
u use listboxname.getSelected()
iBanky at 2007-7-6 > top of java,Development Tools,Java Tools...
# 2
hithanks for the reply.but when i used it i am getting a null pointer exception.i want the listbox of specific row can i get it?pls helpRegardssree
harisree at 2007-7-6 > top of java,Development Tools,Java Tools...
# 3
yes u can , use if whatever with getselected() != nullalso u can choose single or multiple selection on the menu on the right hand side. if user did't click anything then it will hit the code != null.
iBanky at 2007-7-6 > top of java,Development Tools,Java Tools...
# 4

hi

I think u didn't clear with my problem.Let me clear u.I have a table componenet in which first field is a checkbox field second a static text ,then another static text and then a listbox.i can select the check box and also multiple select from listbox.Now when i submit this page i have code like

Iterator rows = getSessionBean1().getSelectedRow().iterator();

List list=new ArrayList();

while (rows.hasNext())

{

getSessionBean1().getEmployeeListDataProvider().commitChanges();

String rowId = (String) rows.next();

RowKey rowKey = getSessionBean1().getEmployeeListDataProvider().getRowKey(rowId);

EmployeeBean emp=(EmployeeBean)getSessionBean1().getEmployeeListDataProvider().getObject(row Key);

String empID=emp.getEmpID();

String empName=emp.getEmpName();

String desig=emp.getDesignation();

//String[] options=(String[])lstRoles.getSelected();

list.add(new EmpResource(empID, empName, desig,"", "", "", "0", "", 0));

}

EmpResourceListDP erp=new EmpResourceListDP(list);

getSessionBean1().setEmpResourceListDP(erp);

ok.That is iterating through the selected rows.so when i am trying to access the listbox(lstRoles) it gives a null pointer exception.

The listbox is binded to sessionbean property which shows all roles

hope u got my problem.Please help me

Thanks and regards

Sree

harisree at 2007-7-6 > top of java,Development Tools,Java Tools...