Deepa
Deepa

Reputation: 11

how to use ajax technology with servlets and jsp for database application?

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?

Upvotes: 1

Views: 1306

Answers (2)

lexicore
lexicore

Reputation: 43709

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

Upvotes: 0

JB Nizet
JB Nizet

Reputation: 692131

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.

Upvotes: 1

Related Questions