problem in SelectItem[ ]

I have used the following code to dinamically display the state in a combo box according to the country selected in another combobox

public SelectItem[] getStateItems[]{

if(!country.equals("")){

String[] listState={};

listState=showState(selectCountry(country));

SelectItem[] stateItems=new SelectItem[listState.length];

for(int i=0;i<stateItems.length;i++)

{

System.out.println(listState[i]);

stateItems[i-1]=new SelectItem(listState[i]);

}

}

return stateItems;

}

public selectItem[] stateItems ={

new SelectItem("","--First Select Country--")

};

In the above code i am able to get all the states and it is successfully displaying in console. But it is not displaying the states in the state combobox.>

[1455 byte] By [Subrat.Ranjan.Raya] at [2007-11-26 17:54:04]
# 1

public SelectItem[] getStateItems[] {

getStateItems[] is not a method. getStateItems() is.

public selectItem[] stateItems

You cannot declare to a variabele. Declare to the type.

This would not compile though. I wonder how you get it running.

Finally rather use collections instead of ordinary arrays.

public List < SelectItem < Object, String > > getSelectItems() {

}

BalusCa at 2007-7-9 5:07:06 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...