-
1 May 2007 4:23 PM #1
Ext + Java + Spring + DWR
Ext + Java + Spring + DWR
Hi,
I have created a little demo to show how to integrate Ext with Java/Spring/DWR. I took the DWR Proxy/Reader that has been posted in the forums and modified it a bit. For example I have a boolean flag that can be passed when you construct a DWR Proxy. This will allow you to indicate if you want to support paging and remote sorting. In case you do your service methods that you expose via spring/dwr will need three additional parameters. But if you don't want to support paging and remote sorting you can leave those parameters out.
The DWR Reader also supports nested properties. For example if you are returning a customer object that has an address object within it.
Here is the url java-ext.zip.
The download is a about 3.5mb but includes everything you need: ext 1.0, dwr, spring, sample code. An ant build file is also included but you may need to modify the build.properties file for your environment.
cheers,
scott
-
2 May 2007 12:17 AM #2
Here, I have a question。
we can call a java object method and get a Javascript object with DWR.
yui-ext only need use MemoryProxy to put the Javascript object in to the Component.
Why do we need a DWRProxy? Improve performance? or in order to use some server characteristics like hibernate delay Loading?
-
2 May 2007 3:03 AM #3
You would want to use the DWRProxy for seamless integration.
1. You don't need to have a separate call back method to handle DWR's response if you use the DWRProxy its handled automatically for you.
2. If you want to do paging and/or remote sorting you don't have to worry about making multiple calls on your own to the remote method on the server. As you page through a grid component, the DWRProxy will make the calls for you.
-
2 May 2007 3:17 AM #4
ListRange purpose?
ListRange purpose?
Thank you for posting this - I'm about to embark on using Ext with Spring and DWR so it should be quite helpful!
Forgive my ignorance on this, I'm yet to even try using Ext in any meaningful way - especially Grids.
Is there a specific reason for wrapping the returned data in the ListRange class? Is this just to get the total number of records to the Grid? Presuming there is no paging involved would returning a List from the DWR call and using the size() of the list achieve the same thing?
-
2 May 2007 4:47 AM #5
-
2 May 2007 6:15 AM #6
Ah, it was so. Thank for your answer and share the source.
-
2 May 2007 9:12 AM #7
Dropped the war under tomcat and I got an error. TodoService is not defined. Fixed it by replacing the absolute javascript paths /springapp/dwr/.... to relative paths dwr/TodoService.js in index.jsp.
Now I don't get any error but no data is being displayed in the grid. All I see are the column hearders. Using firebug I see that the data is being sent back by the server.
-
2 May 2007 9:47 AM #8
hmmm thats weird. Once you have the page loaded try this in the firebug console:
it should return "5", if that works try this:Code:GridUI.getStore().getCount()
it should return "item1". Let me know your findingsCode:GridUI.getStore().getAt(0).data.description
scott.
-
2 May 2007 10:08 AM #9
Ooops I noticed the same problem, I think the compile .class files were out of sync. I recompiled and that did the trick. I have uploaded a new version of java-ext.zip to the same location.
Also I removed my hardcoded webroot and replaced it with "<%=request.getContextPath()%>"
Let me know if you have any more problems.
scott.
-
2 May 2007 11:26 AM #10


Reply With Quote