**=========================== MY JAVA FUNCTION RETURNS AN ARRAYLIST============
public ArrayList<Class1> getDetails(String id, String year) {
ArrayList<Class1> arraylist1 = new ArrayList<Class1>();
return arraylist1;
}
============================== SERVLET CODE =================================
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
try{
String operation=request.getParameter("operation");
log.debug("Operation : "+operation);
Class1 obj1 = new Class1();
response.setContentType("text/plain");
PrintWriter out = response.getWriter();
if(operation.equals("getDetails")){
ArrayList<Class1> record1 = new ArrayList<Class1>();
String id = request.getParameter("id_code");
String year = request.getParameter("fin_yr");
if(id != null) {
record1 = obj.geDetails(id, year);
}
out.print(record1);
}
} catch(Exception e){
log.error("Exception : "+ e.toString());
}
}
======================JSP CODE=====================================
if($('idCode').val() != ""){
$('#IdCode').focus(function(){
var fYear = $('#txtYear :selected').attr('label');
htmlObj = $.ajax({
type: "GET",
url: "Servlet1",
data: "operation=getDetails&id_code="+ $('#IdCode').val() + "&fin_yr="+ fYear,
async: false,
contentType:"text/html; charset=utf-8",
dataType:"html",
success: function(result){
}
}
});
});
}**
In this above code i added dummy function that will return an arrayList after servlet calls that function. Now my question is how do i get arraylist into may jsp page. I got arraylist properly upto servlet i have no idea how do i get it into my jsp page and designs controls as per the size of servlet returned by sevlet.