I need to design a RESTful application which allows me to access the people’s contact information from Facebook.
I stored the First name, last name, email address in the database. For the UI I will use Dojo to display the data.
But I don’t know how to design the middle layer to retrieve the data and how to pass it to the Dojo/javascript.
I have done J2EE development and used Struts framework. I know in J2EE, I can create ent开发者_StackOverflowities beans, and then pass the information to the UI layer through the session beans.
But in a RESTful application, what type of classes do I need to use to accomplish what the entities and session beans can do?
Are there any books that can help me get up to speed ASAP?
I have done this quite rapidly (although I think that there are better ways) with the following steps:
- Created the RESTful web services from db using NetBeans's wizard: http://netbeans.org/kb/docs/websvc/rest.html
In Dojo, I have used
dojo.xhrGet
specifing the url of the service,handleAs
: "json"dojo.xhrGet({ url: myURL, handleAs: "json", headers: {"Content-Type": "application/json; charset=uft-8", "Accept" : "application/json"}, load: function(responseObject) { myList = responseObject; } });
- I have read one by one the items in the list and added to a
dojo.data.ItemFileWriteStore
by usingnewItem
method - I have added the store to a
dojox.grid.DataGrid
精彩评论