使用 JSTL 获取从枚举 class 到 JSP 的下拉列表

Using JSTL to get a dropdown list from enum class into JSP

我是 JSTL 和 Spring 框架的新手。我正在尝试使用 JSTL 标记以 spring 形式填充下拉列表。这些值来自 Enum class。但出于某种原因,我得到了一个空白列表。没有错误消息。

枚举Class:

package edu.bnu.fyp.stp.constants;
public enum TutorType {
    Home_Tutor ("Home Tutor"), Online_Tutor ("Online Tutor");
    private String tutorType;
    private TutorType(String s){
        tutorType = s;
    }
    public String getTutorType() {
        return tutorType;
    }
    public void setTutorType(String tutorType) {
        this.tutorType = tutorType;
    }
}

控制器Class:

@RequestMapping(value = "/studentdashboard/requirement")
public String showPostRequirement(Model model){
    List <TutorType> tutorTypes = tutorTypes = new ArrayList<TutorType (Arrays.asList(TutorType.values()));
    model.addAttribute("TutorType", TutorType.values());
    return "Requirement";
}

JSP

<select name="${status.expression}" name="TutorType" id="TutorType">
     <option value=""></option>
     <items="${TutorType}" var="option">
     <option value="${option}">
         <co:out value="${option.tutorType}"></co:out>
     </option>
     </>
</select>

请告诉我我哪里做错了?谢谢

我编辑了 jsp 代码,现在可以使用了。

<select name="tutorType" id="tutorType">
    <option value=""></option>
    <co:forEach items="${tutorType}" var="value">
       <option>${value}</option>
    </co:forEach>
    </>
</select>