新手筆記:
//枚舉
text, number, alphaint, select, checkbox, date
}
// 獲取所有商品屬性類型
public List<AttributeType> getAllAttributeType() {
List<AttributeType> allAttributeType = new ArrayList<AttributeType>();
for (AttributeType attributeType : AttributeType.values()) {
allAttributeType.add(attributeType);
}
return allAttributeType;
}
在jsp頁面上使用jstl
<select id="productAttributeType" name="productAttribute.attributeType" >
<option value="">請選擇...</option>
<c:forEach items="${allAttributeType}" var="list">
<option value="list">
${list}
</option>
</c:forEach>
</select>