0
JSTLとSpring Frameworkの新機能です。私はJSTLタグを使用して春のフォームでドロップダウンリストを設定しようとしています。値はEnum class
から来ています。しかし何らかの理由で私は空リストを取得しています。エラーメッセージはありません。JSTLを使用してenumクラスからJSPにドロップダウンリストを取得する
ENUMクラス:
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;
}
}
コントローラクラス:
@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>
私はこの間違ったをやっているところ私に知らせてください!ありがとうございます
なぜ、Spring MVC独自の '
そのno-nameタグの代わりに ''を実行した場合に役立ちます。実際に 'TutorType'を' model'に追加すると助けになります。 –
Andreas
それはTypoだった、私はモデルにTutorTypeを追加しました。ちょうど説明を更新しました。 –