0

I want to pass arraylist containing values from database to jsp page using ajax. but actually i dont know how to pass. what i have written i have pojo class contains getter and setter methods. i fatching the data from database and set to pojo methods then adding to arraylist. before that i was this arraylist by simply get and set attribute method. and now i want this arraylist in jsp as arraylist using ajax call.

what i am trying :

 protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

            response.setContentType("text/plain");
           // response.setHeader("Cache-Control", "no-cache");
            FeedData f = new FeedData();
            ArrayList<FeedBean> list = (ArrayList<FeedBean>) f.getFeedData();

            request.setAttribute("allData", list);

}

Here is ajax code:

$(document).ready(function() {
  $('#getData').click(function(){ 

    $.get('CommonServlet', {

    }, function(responseText) {

    });
}); 
});
Irshad Qureshi
  • 65
  • 1
  • 2
  • 6

0 Answers0