使用html:select標籤,不能像在html中使用select標籤一樣,只在<option></option> 中設置selected就可以設置默認值。而應該在<html:select>中來設。如:
<html:select property="discountType" value="2" οnchange="showPage(discountType)" >
<html:option value="1"><bean:message key="discountType.holiday" /></html:option>
<html:option value="2"><bean:message key="discountType.week" /></html:option>
<html:option value="3"><bean:message key="discountType.date" /></html:option>
</html:select>
加上:value="**",這樣就可以將其初始值設爲2,頁面則顯示其對應的信息<bean:message key="discountType.week" />