how to load data from db table to browser and update the data back to db?
I have a scenario that, I need to load the data from database to the client(browser). Few of these fields would be marked as editable where users can enter data and update. here we are using jquery and css styles to make te开发者_如何学Pythonxtareas editable.
I made these for each row which am shwoing as html table format, and show an edit button for each row upon click on this the textareas will become as editable and initially it would be readonly type, here ID will not be editable.
users can use selected rows and update them. I would have a save button at end of the table which I need to update the table rows back to the database. and if cancel button selected the data need to be reloaded from database instead of updating, i.e. its like page refresh.
Can you please let me know which way we can achieve this using JSP/Hibernate/Spring
in my web application.
This is a very big problem, a broad question. It's hard to answer without knowing what you already know how to do and what you're ignorant of.
- How much have you used Spring, Oracle and Hibernate?
- How well do you know Java?
- How well do you know JSP, JSTL, HTML, HTTP, CSS, and JavaScript?
Like any large problem, it's best to attack it by breaking it into smaller pieces:
- Write a separate persistence tier that can perform CRUD operations on the tables in question. Just use JDBC to start.
- Write model objects that can deal with the data and their relationships.
- If you really want Hibernate, write the mappings from your tables to your model objects.
- Write unit tests that demonstrate all the functionality that you need without a UI.
- Write Spring controllers to manage the interactions you need from the UI.
- Write JSPs to act as the views for Spring.
Your question is too broad. You'll get a better answer if you narrow it down and demonstrate what you already know.
If you don't know how to do any of this, you're in the wrong place.
You can use JSON for transporting data for communicating with server, As @duffymo suggested, it can be achieved using JSP or Servlet
After getting DB records,set them into Beans [ Jettison comes to rescue here http://jettison.codehaus.org/ ] and then convert the beans into JSON, similarly from browser you need to post JSON data,which will be converted back into a bean.
Handling JSON in browser with JQuery and Javascript will be cakewalk.
精彩评论