save dynamic data to Database in spring mvc and hibernate
I have a table with one row..user can add or delete rows(using javascript to add dynamically)..
How can I send the data entered in the rows to database and also should retrieve the same when user comes back to see the data in future..using hibernate for mapping..using spring form tags and model attribute..
just need a brief idea on how to send dynamic data to database using hibernate
any suggestion is appreciated...thanks in advance!
Take a look at this post about spring+hibernate integration. There are plenty of examples of these technologies usage.
http://www.mkyong.com/spring/maven-spring-hibernate-mysql-example/
Edited: I think the easy way would be:
1) Retrieve data from your table and send it via Ajax using JQuery, take a look at this example.
2) Use a Servlet to reive your JSON data, convert it to an object using json-lib, here some snippets from the official page.
3) Return data as json, and make sure you use the correct "application/json" content type.
If you are planning to send ajax data in various scenarios in your application, consider to use a framework like Jersey or Restlet to send JSON data via RESTFUL services to implement your server side componentes instead of using just a servlet.
链接地址: http://www.djcxy.com/p/46078.html上一篇: 将java对象转换为json