0
Design a form(<spring:form></spring:form>) in JSP using Spring MVC architecture
從控制器Enum.values綁定模型屬性默認
看我使用綁定的組合和默認值選擇列表什麼碼值。
m.addAttribute("questTypes", Enum.values());
m.addAttribute("defsel", Enum.Value1.getName());
然後JSP頁面上寫這樣的代碼
<form:select path="otquestion.otQuestionId" class="combobox required" style="float:left;" id="selectQuestid">
<form:option label="Select Question Type..." value=""></form:option>
<form:options items="${questTypes}" selected="${defsel}" itemLabel="name" itemValue="value"></form:options>
</form:select>
最後名單的來源,但組合的默認選擇不工作。請幫助
檢查http://forum.spring.io/forum/spring-projects/web/73245-form-select-tag-chose-one-option-as-selected – kranthi117
我已經在forum.spring上通過了。 io/forum/spring-projects/web/73245-form-select-tag-chosen-one-option -as-selected,但沒有得到任何答案。 –