bouncingHippo
bouncingHippo

Reputation: 6040

how to display a default option in a dropdown list

Given

<html:select property="loginPathId" style="width:190px">
    <option value=""></option>
    <html:optionsCollection property="loginPath" value="id" label="displayName"/>
</html:select>

Right now, it is a dropdown list with an empty default value. how do i populate it by default with say option value=1?

Can this be done without using jQuery, and only with struts, java, javascript and html?

Upvotes: 1

Views: 2424

Answers (2)

PSR
PSR

Reputation: 40348

<html:select property="status" value="...your status choise here...">
  <html:optionsCollection name="loginPath" label="displayName" value="id" />
</html:select>

Upvotes: 0

tymeJV
tymeJV

Reputation: 104795

Inside the option you wanted selected:

<option selected="selected">value</option>

Upvotes: 2

Related Questions