I have implemented a struts 2 autocompleter in which i have used a list of String like this -
<sj:autocompleter id="cityId"
cssClass="txtfield8"
name="outlet.cityName"
list="cityList"
autoComplete="true"
forceValidOption="false" />
How can I set a default value for this, so that every time it loads, a default value will be shown ?
You should use the
valueattribute as suggested by @Choatech:The value specified, however, should be one of the keys listed in your
cityList, not some random value.If the value you want to use is an header one, like
Please choose a City..., then consider using the