私のSpringアプリケーションにはBeanが1つあります..
public class SampleBean{
private String id;
private String name;
private String marks;
--------
--------
}
そして、私の別のサービスBean Crating Propertyのような..
List<SampleBean> list = new Array<SampleBean>();
//Setter and getters
そして、私のコントローラークラスでいくつかの値を設定しますlist
そして今、私のjspはJqueryを使用してこれらの値を取得しています..
<c:set var="modalAttributeName"value="MODEL1" />
<c:set var="modalAttribute"value="${requestScope[modalAttributeName]}" />
<form:select class="select_box" path="country" id="country">
<form:options items="${modalAttribute.list}" />
</form:select>
のような Bean 名全体を表示していますSampleBean@0
しかし、私はこの選択ボックスにSampleBean
クラスname
のみを入れたい..
では、Jqueryを使用して名前を表示するにはどうすればよいですか?
EDIT
私はこのようにしようとしていますが、空のボックスが表示されています..
<form:select class="select_box" path="country" id="country">
<c:forEach items="${modalAttribute.list}" var="result">
<form:options item="${result.name}" />
</c:forEach>
</form:select>