jqueryajaxjspservlets

"Load more" button using Servlet,JQuery,JSP


I am trying to implement simple "load more" button in my project. I have grid with items and I want to load more items when somebody clicks on load more button.I found some tutorials but they are mostly for PHP. The ones I found for servlets added just some text or simple html elements. I want to add a dynamicly created html elements from jsp. I know I could just write it as string response directly in the servlet but I want to have it as much simple as possibly can be.

Do you have any suggestions?


Solution

  • The scenario is simple. When the user presses the button make an ajax call to the servlet where you make the query to the database, create a json object and return it to the client. Then construct the required html elements dynamically with javascript in the succes callback function.