1

how to use ajax technology with servlets and jsp for database application? I am creating a jsp from it calls to javascript. Javascripts calls servlet where database is accessed. how to pass the data back from servlet?

Deepa
  • 11
  • 2

2 Answers2

1

The data is usually returned to the browser as

  • HTML markup (presentation + data), by simply forwarding to a JSP, or
  • XML (data only), by generating XML in the servlet (using JAXB for example) and sending it in the response writer
  • JSON (data only), by generating JSON (using GSON for example) in the servlet and sending it in the response writer.

JavaScript is able to digest these three kinds of data and update the contents of the displayed page.

JB Nizet
  • 678,734
  • 91
  • 1,224
  • 1,255
0

Check DWR, it is a very easy to use AJAX implementation.

lexicore
  • 42,748
  • 17
  • 132
  • 221