A number of approaches come to mind:
The first two are the basic approaches:
1) Return the pure data (via JSON), and iterate over it in the client, creating the DOM structure of the table from it.
2) If you are already using
JSP or some other templating engine on the server, have the response return an already-formatted HTML fragment to inject into the DOM.
A third approach would be the most modern, and a logical extensions of #1 combined with #2:
3) Return the pure data (via JSON), and format it for DOM insertion using a client-side templating engine such as handlebars or mustache.
At this stage of the game, #3 would be my recommended approach.