Hybrid View
-
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
-
3 May 2007 12:00 AM #6
I'm thinking of adding to my ListRange class, things like return status level, (SUCCESS, WRANING and FATAL), and return message, so that errors which break the grid, and failures which don't break the grid, but cause individual operations not to work can be handled elegantly by the Grid.
-
13 May 2007 1:28 AM #7
about api Ext.onReady .
the Ext.onReady(GridUI.init) is also running in the application
I do not understand the difference of
Ext.onReady(GridUI.init, GridUI, true);
and
Ext.onReady(GridUI.init);
most demo of the yui is onReady(Function fn) and
could you tell me how to use onReady(Function fn, Object scope, boolean override)?
thanks.
-
2 May 2007 6:15 AM #8
Ah, it was so. Thank for your answer and share the source.
-
2 May 2007 9:12 AM #9
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 #10
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.


Reply With Quote