RE: setting the default selection of an html:select. You can set the default value of the form bean's corresponding (corresponding to the html:select, that is) property. But if the act of selecting is supposed to trigger something (eg: populating another list), you've still got a problem.
Here's my select:
*************************************************************************
<html:select styleId="fSelect" property="layer" onchange="showFields()">
<html
ptions property="listLayers"/>
</html:select>
*************************************************************************
Here's the form bean:
*************************************************************************
public class FormFields extends ActionForm{
private List listLayers = new ArrayList();
public FormFields(){
super();
listLayers.add("Agricultural Features");
listLayers.add("Agricultural Fields");
listLayers.add("Open Space");
// etc.
}
private
String layer= "Open Space"; // <--- NOTICE
private List fieldResults = null;
public void setLayer(String layer) { this.layer = layer; }
public String getLayer() { return layer; }
public void setFieldResults(List fieldResults) { this.fieldResults = fieldResults; }
public List getFieldResults() { return fieldResults; }
public void setListLayers(List listLayers) { this.listLayers = listLayers; }
public List getListLayers() { return listLayers ; }
}