Tuesday, January 6, 2009

gwt-ext/php/mysql

there are three ways to get data from mysql in gwt-ext:

1. requestion JSON using HTTP
http://code.google.com/docreader/#p=google-web-toolkit-doc-1-5&s=google-web-toolkit-doc-1-5&t=GettingStartedJSON

2. gwt-RPC, which you have create bouch of code, which looks so weird and ugly to me, to connect to MySQL server, create SQL query and return the data to gwt-ext to populat whatever widget you want;
http://code.google.com/docreader/#p=google-web-toolkit-doc-1-5&s=google-web-toolkit-doc-1-5&t=DevGuideHttpRequests

3. use php file, let php go connect to MySQL and return JSON data(or xml data).

obviously 3 is way more simpler and cleaner, but hard to get it work in gwt-ext. tried to put the php file in 'public/data' folder, and in java code, call the following:
new HttpProxy("data/getData.php");

it return php file itself instead of JSON data.... maybe should try the following:

new HttpProxy("data/getData.php", Connection.GET)

???

No comments: