Weekly GWT Links for 2/23/08

February 23rd, 2008 - Written by in News

Lots of interesting GWT happenings this week.

gwt rolodex widget
GWT Rolodex Widget
  • – Chris Jones has just created a project for his gwt-rolodex widget that is currently in use in his Yesmail Enterprise product.
  • An Interview with Sanjiv Jivan – InfoQ has posted an interview with GWT-Ext creator Sanjiv Jivan discussing the recent GWT-Ext 2.0 release.
  • GWT Designer 4.0.0 released – New features include a new GWT JUnit TestCase Wizard and improved support for the GWT-Ext and MyGWT widget libraries.
  • GWT: DOM and Opacity – A short tutorial by Dietrich Kappe showing how he created his own DOM implementation to set the opacity of an element in a cross-browser way.
  • Enabling Test Driven Development in GWT client code – An article discussing how to structure your code to do TDD with GWT.
  • Chronoscope 0.8 released – This new release of Chronoscope features IE/Flash rendering support, an experimental Java2D renderer and appendable datasets.

Remember to keep up with the latest GWT news by .

No Comments Stumble it!

Working with PHP in GWT hosted mode

February 19th, 2008 - Written by in Using GWT

Normally, when developing your GWT applications in hosted mode, the internal tomcat server will be used to serve up your application. However, if want to talk to a server-side php script running on your own local web server, you will soon run into issues with the , since hosted mode runs on one port and the php script is running on another. In this tutorial, I will show you how I got around by running my GWT application and the php script on the same local web server. To demonstrate this, I will use the GWT FileUpload widget with a php backend.

Getting started

This tutorial assumes you already have a local web server running that can handle php. I am personally using Apache via MAMP on OS X. XAMPP is also another easy to setup alternative for Windows.

To start, I created a project called FileUploader and imported it into my IDE (Eclipse). The code for the FileUploader module is directly taken from the example code in the FileUpload widget javadoc.

The only modification I made was to the setAction method of the FormPanel object.

()

final FormPanel form = new FormPanel();
form.setAction(GWT.getModuleBaseURL() + "upload.php");

Now when the user hits submit on the form, it will call the php script called upload.php to handle the file upload.

Using -noserver

To tell hosted mode not to use the internal tomcat server, we will pass the -noserver argument to the GWTShell. But first we have to perform the following steps:

First, notice that the url of my application is: http://localhost/com.gwtsite.FileUploader/Fileuploader.html

So I created a folder called com.gwtsite.FileUploader in my web server’s web documents folder. Next, I compiled my application and copied the following files to this new folder:

  • FileUploader.html
  • gwt.js
  • hosted.html
  • history.html
  • com.gwtsite.FileUploader.nocache.js

Then for the program arguments, i set the -noserver parameter and since my web server is running on port 80 I also set the -port parameter to 80.

fileuploader parameters

Finishing up

The upload.php script for handling the upload was taken from the online php manual. I placed it in the same com.gwtsite.FileUploader folder on my web server. All it does is move the uploaded file from the temp location to the specified directory. Notice that uploadFormElement matches the name set on the GWT FileUpload widget.

()


$uploaddir = './';
$uploadfile = $uploaddir . basename($_FILES['uploadFormElement']['name']);
echo '
';
if (move_uploaded_file($_FILES['uploadFormElement']['tmp_name'], $uploadfile)) {
    echo "File is valid, and was successfully uploaded.\n";
} else {
    echo "Possible file upload attack!\n";
}
...
?>

Once this is all wired up, I can now start up hosted mode from within my IDE and successfully upload files from within my GWT application.

References

7 Comments Stumble it!

Weekly GWT Links for 2/16/08

February 16th, 2008 - Written by in News

Here were some of the more interesting GWT related items I read about during this past week.

goChongo
  • goChongo – This is a really neat, interactive site built using GWT. You can create contests as a Producer and/or participate in contests as a Performer. You can even earn money depending on how popular your submissions are.
  • – Evan Tice shares his experiences on the Google Web Toolkit blog about developing his GWT application, MapEcos.
  • – There’s an informative discussion on the GWT forums about using LGPL libraries with your GWT applications.
  • GWT: improving performance – Interesting article about speeding up the layout of GWT components.
  • Hibernate, Swing, Google Web Toolkit – Part Three – A three part series on integrating GWT with Spring and Hibernate. [Part 1][Part 2]

Don’t forget to keep up with the latest GWT news by .

No Comments Stumble it!

« Previous Entries Next Entries »