I have question model as follows
public class Question{
String question;
String optA;
String optB;
String optC;
String optD;
//getter and setter
}
Question List is as follow
questionList = new ArrayList<Question>();
questionList.add(new Question("Which of these method is used to find out that a thread is still running or not?"," checkRun()"," Run()","Alive()","isAlive()"));
questionList.add(new Question(" Which of these method waits for the thread to treminate?"," Run()","Alive()","sleep()","join()"));
In Controller I have passed list as follows
model.addAttribute("data", questionManager.getQuestionList());
In jsp page
var json = "${data}";
$.each(json, function (index, item) {
console.log("qustions"+item);
});
In json varible data is as follows
var json = "[com.hello.in.model.Question@405b7c, com.hello.in.model.Question@9393a9]";
How can I iterate data??
I can get question,optA and other by following code
<c:forEach items="${data}" var="question">
${question.question}<br>
</c:forEach>
but i want values of qestions inside js.
$( document ).ready(function() {
//I want here coz i want to do some processing
}
How Can I do that??