Thursday, 29 March 2012

My new showcase

http://smapshow.appspot.com

That is to prove that GWT app can just look like a normal commercial web site.  And it also contains my SMap showcase.

Been quite busy recently, I have stopped developing SMap for a while, but evey time I look at her I still feel so proud.  I think I can make it better than Openlayers in the future, consider I am the only developer I would say I have made a very good progress!

Tuesday, 27 March 2012

GWT Spring Hibernate/JPA (part 2)

Now we will add spring framework to this project. Normally I use maven to manage j2ee projects,but with GWT, I've spent a lot of time(with the GWT maven plugin) and still can't make the IDE and maven work together very well. So I decided only use maven to manage the dependencies and leave the rest to eclipse.


Attached file is my demo project(windows, eclipse3.7 with google plugin) , I think a experienced programmer would prefer trying that first. The demo also includes some design/widgets I created based on my experience and needs.
It should work straight away. (rightclick->run as->web application) .

in /libs there is the pom.xml with all dependency. Inside this file you can see
<outputDirectory>../war/WEB-INF/lib</outputDirectory>
which pointing to the output directory.

you can run mvn process-resources, that will fetch all dependency jars to war/WEB-INF/lib.

In WEB-INF, I put 3 xml files in the spring folder as usual. and web.xml needs to modify. (see my demo)

you may need to change <context:component-scan> to specify the package to scan.
In datasource.xml , this line tells spring to look for "config.properties" in classpath
<context:property-placeholder location="classpath:config.properties" />

I feel there is no need to explain normal spring  stuffs,  let me know if you have questions about my demo.

GWT Spring Hibernate/JPA (part 1)

In eclipse, using Dynamic Web Project is the most easy way to develop/debug a spring powered j2ee project. However when developing GWT apps, it's a shame not to use google's eclipse plugin, which will set the project as a "Web Application Project".

The first part will tell you how to create a eclipse project has both facets.

First you need to have the Eclipse IDE for Java EE Developers (http://www.eclipse.org/downloads/)

1 create a google GWT project with Google eclipse plug-in. (install it if you haven't https://developers.google.com/eclipse/ )

2 right click project,  properties-> project facet-> convert to facet form -> check dynamic web module facet in the list.

3 using Windows Explorer, navigate to the project folder -> ./settings -> org.eclipse.wst.common.component, open this file with any text editor,

modify this line:
<wb-resource deploy-path="/" source-path="/WebContent" tag="defaultRootSource"/>
to
<wb-resource deploy-path="/" source-path="/war" tag="defaultRootSource"/>
then refresh the project in eclipse.



After these simple steps the project is configured as google gwt project and also a WTP project.
That allows this project to be run/debugged as a GWT app or a normal web app. (right click->run as)