EXTJS,GWT RPC ...an experiment on widgets

I was doing samples on GWT during my free time.I tried Ext-GWT (not GWT-Ext).There are lot of articles / screen casts around the web regarding how to work out RPC in GWT.Some people mess up sometimes.So I decided to document the method that worked out for me. This is for the GWT version 1.5.3.It supports Java 1.5.Even if GWT is using java, we are not supposed to harness the very features of Java 1.5.Anyway GWT is the Swing for web.Adding the elegant extjs with GWT is indeed a good choice for RIA development.ExtGWT is a library written in Java.If you need a kick start - go here - http://extjs.com/helpcenter/index.jsp having screenshots for setting up a project.If you are using eclipse for GWT development there are a lot of plugins around, like gooplise .I know I will mess up with that.So I decided to develop from scratch than plugin generated RPC codes.Before creating packaging structure we have to be aware of the Directoryconvention used in GWT RPC

More detailed RPC development here

The server code should go to "server" and client inside "client" We can override the paths in app.gwt.xml If we add a " < server path="path" > ,for packages/ modules added . We have to add the client and intl paths which are default.Its similar to java default constructor, when we add a arg constructor, the def constructor will be overridden... sort of

So I developed a poll in EXT- GWT ..oof .Compiling seems slow.I found it very difficult to debug.Common issues and resolutions:

a.com.google.gwt.user.server.rpc.RemoteServiceServlet - ClassNotFoundException
resolution - put the Service interface and ServiceAsync implementations inside client. In the server side, point the server path to the Service implementation.Try to run the server classes to invoke RPC after deploying in jetty/tomcat

ie. in gwt.xml it will be

<servlet path="/VoteService" class="demo.app.server.rpc.VoteServiceImp" />

in web.xml

<servlet>
<servlet-name>vote</servlet-name>
<servlet-class>demo.app.server.rpc.VoteServiceImp</servlet-class>
</servlet>

<servlet-mapping>
<servlet-name>vote </servlet-name>
<url-pattern>/VoteService </url-pattern>
</servlet-mapping>

b. do not forget to call layout.. when using ext implementations

c. there are tab panel rendering issues... i have to resolve

d. mmm got problem with serializations. I was transferring a map of string keys and Integer values.So used annotations....

/*
* @gwt.typeArgs <java.lang.string,java.lang.integer>
* */

Interface looks cool.. using GWT the code becomes maintainable.They are new products, so we have to think of choosing them for production quality applications...

I have to go deep into these .Anyway I have made some samples.. i have uploaded one

download code

Use eclipse. The setup and configurations can be seen from previously screencast/article links .Compile using GWT dev tool.Transfer the generated classes to WEB-INF/classes folder.Add gwt-server.jar to libs. Access the App.html to see the widget.

In my opinion working on EXT-GWT will be overkill.We have to resolve the issues of both !!!

I will document a better one later.... Now see the screenshots.









No comments:

Post a Comment