populating SelectOneMenu using ArrayList
I have initiated an ArrayList which will hold the 50 US states in an Action class.
In the jsp page, the code goes like:
<h:selectOneMenu id="state" required="true" style="width:100%" value="#{memberSearchAction.state}">
<f:selectItems value="#{memberSearchAction.stateList}" />
</h:selectOneMenu>
In the Action class,
private String state =null;
private ArrayList stateList =new ArrayList();
publicvoid setStateList(ArrayList stateList){
stateList.add("Alabama");
stateList.add("Alaska");
stateList.add("Arizona");
....
}
public ArrayList getStateList(){
return stateList;
}
public String getState(){
return this.state;
}
publicvoid setState(String a_strState){
this.state = a_strState;
}
I would like the dropdown menu to be populated with the states. Will this code work? Where am I going wrong, as it does not get populated?
PS: I am a total newbie to the field of programming. Kindly help. Thanks

