Setup SmartGWT and Eclipse with -noserver params

Environment:

  • Java 1.6
  • Eclipse 3.5
  • GWT Designer 7.1
  • GWT 1.7
  • SmartGWT 1.2
  • Apache/PHP 2.0/5.2.9

The idea is setup an eclipse project, use SmartGWT that it can deploy to another php project (with param -noserver) and run in debug mode . The ideally way is we can just change code in Eclipse without restart server or refresh browser. Example click on button Click me then show popup message "Hello GWT", then change message to "Hello SmartGWT", and just click button again.

Here are my study in a Sunday noon, after try to use Helloworld 1.6 is included in smartgwt1.2.zip

  1. Step 1: New a GWT project with a example module (GWT Design will automatically add gwt_user.jar to project)

  2. Step 2: Add two libraries are smartgwt.jar and smartgwtskin.jar (name of libraries may be wrong :P)

  3. Step 3: Run compile project to folder war

  4. Step 4: Edit file war/module_name.html add these lines to

    <!-- IMPORTANT : You must set the variable isomorphicDir to [MODULE_NAME]/sc/ so that the SmartGWT resource are correctly resolved -->

    <script> var isomorphicDir = "helloworld/sc/"; </script>

  5. Step 5: Copy folder war to php project. We can test on Firefox with url: /war/.html. If it work well, copy url

  6. Step 6: Open run configuration, new or edit (if existed) project run configuration and do: check noserver and patse the url. Then click apply.

  7. Step 7: Run in debug mode

  8. Step 8: May be Hosted server throws error "Invalid module ...xxx". Don't afraid! Just click Hosted Browser and paste url to it.

  9. Step 9: If url can not run and hosted server still throw errors. Try refresh the hosted browser, because IE may be cache file.

  10. Step 10: Change code in Eclipse and test on browser.

That's all. Some errors which I met are
  • Invalid module (always meet)
  • Could not find helloworld.gwt.xml in your classpath (error when I use helloworld 1.6 project include in smartgwt1.2.zip)
  • Could not find $wind.isc (may be cache, or you do not copy right files and folders)

Now code for fun!!!

2 comments:

blo

June 27, 2010 at 7:07 PM

hey hello...I'm trying to achive something easy (I think) with smartgwt but I really can't figure out how... I'd be glad if you could help me!

given some ListGrid populated with json datasource file (made by hand), how can I manage to store and load selected values (suppose checkbox listgrid)... I'm confused because ListGrid has already had a datasource set.

Thanks! you could write me at sindroide@gmail.com please

Willy

July 13, 2010 at 11:04 PM

Hi,
Thank's for this help.
Could I realy add PHP and SQL request in the javascript generated?

(Unfortunuatly, GWTPHP is not distribued... also i search a other solution..)

Thank's for all