Drop Down List

Hi,

I want to use Drop Down List.In Drop Down list i want to retrieve the value of Drop Down List.

For example i create Drop Down List as follow:

Iterator<Category> it=allCategory.iterator();

int i=0;

while(it.hasNext())

{

Category cat1= it.next();

listoption=new Option(cat1,cat1.getName());

i++;

}

And in want to retrieve the cat1 for selected option.

I used following code:

Category c= (Category) dropDown1.getValue();

But it gives me CastException.

I also use:

//dropDown1.getItems();

// dropDown1.getSubmittedValue();

// dropDown1.getSelected();

//dropDown1.getValue()

but none of them work.In some of them gave me the error CastException and in one of them gave me null(I think in getSubmittedValue();)

What must i do?

[872 byte] By [Khosroa] at [2007-11-27 9:57:39]
# 1
in the while :Category cat1= it.next();listoption=new Option(cat1,cat1.getName());i++;
Khosroa at 2007-7-13 0:27:59 > top of Java-index,Development Tools,Java Tools...