PDA

View Full Version : how to set the value to <select> dynamically


msg2ajay
08-17-2007, 09:02 AM
hi all,
I have a problem with <html:select> i am getting a value from the database
but it is not setting to my <select value>. Can any bady tellme what is the problem. My come is given below..




<html:select property="conttitle" styleClass="dropdown" value="${conttitle}">
<html:option value="1">1 - Mr</html:option>
<html:option value="2">2 - Ms</html:option>
</html:select>


thx in Adv,
HAN.

_Aerospace_Eng_
08-17-2007, 09:09 AM
The select has no value, to set a default value you need to make one of the options selected. Something like this
<html:select property="conttitle" styleClass="dropdown">
<html:option value="1" selected="selected">1 - Mr</html:option>
<html:option value="2">2 - Ms</html:option>
</html:select>
Now the default value will be 1.

mlseim
08-17-2007, 01:17 PM
<html:select property="conttitle" styleClass="dropdown" value="<?=${conttitle}?>">
<html:option value="1">1 - Mr</html:option>
<html:option value="2">2 - Ms</html:option>
</html:select>

nevermind ... I think I misread the original question (sorry).