How to get Value from List<Bean> object in Jquery using Spring?

In my Spring Application have one Bean..

    public class SampleBean{
      private String id;
      private String name;
      private String marks;

And my Another Service bean Crating Property like..

List<SampleBean> list = new Array<SampleBean>();
//Setter and getters

And in my Controller class Set some values to list

And now my 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}" />

It is showing entire Bean name like SampleBean@0

But i want in this Select box only SampleBean class name only..

So how to Display name using Jquery?


i'm trying like this but empty box showing..

     <form:select class="select_box" path="country" id="country">
        <c:forEach items="${modalAttribute.list}" var="result">
            <form:options item="${}" />


Add this list to your model attribute map. I assume you already have a model map passed into your controller method. So for example:

model.put("list", list);

If you don't have the model map passed to your method, then just another parameter: Map<String, Object> model.

Then in your JSP:

 <form:select class="select_box" path="country" id="country">
    <c:forEach items="${list}" var="result">
        <form:option value="${}">
            <c:out value="${}"/>

a possible sulition can be render the list as JSOn from controler and catch it in a java script code making an ajax call , thus its easier to use in jquery

Need Your Help

What's the fastest way to save/load a large list in Python 2.7?

python list python-2.7 io save

What's the fastest way to save/load a large list in Python 2.7? I apologize if this has already been asked, I couldn't find an answer to this exact question when I searched...

How can I restart DataNucleus within a single JVM run?

java unit-testing datanucleus

I'm writing tests for my database access and tend to start them by destroying the database file, then adding data, and having the tests run. (This is to test my business logic--I trust the DataNucl...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.