java - How to get Value from List<Bean> object in Jquery using Spring? -
in spring application have 1 bean..
public class samplebean{ private string id; private string name; private string marks; -------- -------- } and service bean crating property like..
list<samplebean> list = new array<samplebean>(); //setter , getters and in controller class set values list
and jsp i'm getting these values using 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> it showing entire bean name samplebean@0
but want in select box samplebean class name only..
so how display name using jquery?
edit i'm trying empty box showing..
<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>
add list model attribute map. assume have model map passed controller method. example:
model.put("list", list); if don't have model map passed method, parameter: map<string, object> model.
then in jsp:
<form:select class="select_box" path="country" id="country"> <c:foreach items="${list}" var="result"> <form:option value="${result.name}"> <c:out value="${result.name}"/> </form:option> </c:foreach> </form:select>
Comments
Post a Comment